在 PHP 的 IF 条件中使用 OR 语句


using OR statement in IF condition in PHP

可能的重复项:
在 PHP 中使用 URL 隐藏当前导航选项卡

在没有 PHP 扩展的情况下对当前选项卡进行 hilighiting

不起作用
<?php if ("index.php" || "index"==$Current) 
  {echo "selected";}else {echo "";}?>

我想你想要:

<?php if ("index.php"==$Current || "index"==$Current) {
          echo "selected";
      }else {
          echo "";
      }
?>

你写的东西真的没有意义。

此代码

if ("index.php" || "index"==$Current) 

已经返回 true,因为

if ("index.php") 

相同

if ("index.php" != "")