小编las*_*rew的帖子

PHP如果/ else切换不起作用

目标:当URL等于"enhanced.php"时,尝试将翻转按钮状态保持为"ON".

问题:当URL等于"enhanced.php"时,按钮状态不会保持"打开"状态.

(按钮可正确用作翻转)


sidemenu.php sidemenu.php用作所有页面上的PHP包含(我不知道这是否有所作为

<?php

$script = $_SERVER['SCRIPT_NAME'];


//Set the default state to OFF and only turn ON if we are on the current URL.

$enhancedstate = OFF;


$pos = strpos($script, "enhanced.php");
if($pos === true) {
$enhancedstate = ON;
}


?>


 <div class="sideMenu">   

   <a href="enhanced.php" 
      onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image1','','/images/Button_ON_01.gif',1)">
      <img src="/images/Button_<? echo $enhancedstate; ?>_01.gif" name="Image1" border="0">
   </a>
Run Code Online (Sandbox Code Playgroud)

当当前URL为"enhanced.php"时,任何人都会看到为什么按钮状态不会保持"ON"的任何原因.TIA

php if-statement

2
推荐指数
1
解决办法
326
查看次数

标签 统计

if-statement ×1

php ×1