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

时间:2012-05-24 04:40:52

标签: php html css

  

可能重复:
  Hilighting The Current Navigation Tab Using URL in PHP

在没有php扩展功能的情况下hilighiting当前选项卡

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

2 个答案:

答案 0 :(得分:0)

我想你想要:

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

你所写的内容并没有多大意义。

答案 1 :(得分:0)

此代码

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

已经返回true,因为

if ("index.php") 

相同

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