【发布时间】:2013-02-06 02:03:33
【问题描述】:
我有这个字符串:
$currentpath = basename(__FILE__);
如果我写
echo $currentpath;
它返回 navleft.php
现在我的功能:
function colorButton() {
if($currentpath == "navleft.php") {
echo "navbuttonon";
} else {
echo "navbuttunoff";
}
}
但是如果我调用函数
colorButton();
我总是得到 navbuttonoff。
为什么会这样?
【问题讨论】:
-
你舒尔你舒尔吗?
:D
标签: php string function if-statement