【问题标题】:using OR statement in IF condition in PHP [duplicate]在PHP的IF条件中使用OR语句[重复]
【发布时间】:2012-05-24 04:40:51
【问题描述】:

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

在没有 php 扩展的情况下显示当前选项卡不起作用

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

【问题讨论】:

标签: php html css


【解决方案1】:

我想你想要:

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

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

【讨论】:

  • 这是合法的语法,但没有多大意义。
【解决方案2】:

这段代码

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

已经返回 true 因为

if ("index.php") 

一样

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

【讨论】:

    猜你喜欢
    • 2012-12-15
    • 2019-03-01
    • 2016-05-28
    • 1970-01-01
    • 2011-12-08
    • 2022-10-01
    • 1970-01-01
    • 1970-01-01
    • 2020-07-23
    相关资源
    最近更新 更多