首页 >后端开发 >php教程 >关于php获取变量有关问题

关于php获取变量有关问题

WBOY
WBOY原创
2016-06-13 10:28:33879浏览

关于php获取变量问题

PHP code
<!--Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->@$judge=$_GET["speed"];if(@$keyboard=$_GET["keyboard"]){$keyboardfinal=100;}if(@$judge==1){if($keyboard0){@$keyboardfinal=50;    }}if(@$judge==2){if(@$keyboard0){$keyboardfinal=50;    }}if(@$judge==3 && (@$keyboard0)){$keyboardfinal=50;    }

如上代码~为什么在第二,三,四个if语句中,即使条件成立任然无法使$keyboardfinal=50;成立为什么呢?


------解决方案--------------------
@$judge=$_GET["speed"];
[email protected]?
------解决方案--------------------
不明白楼主为什么要加那么多错误控制符,如果不报出错误,你怎么修改代码呢?
将楼主的代码修改了下:
PHP code
$judge = 1;$keyboard = 35;$keyboardfinal = null;switch($judge){    case 1:        if($keyboard0)            $keyboardfinal=50;        break;    case 2:        if($keyboard0)            $keyboardfinal=50;        break;    case 3 && ($keyboard0):        $keyboardfinal=50;        break;}echo "keyboardfinal-->>".$keyboardfinal;#50<br><font color="#e78608">------解决方案--------------------</font><br>
探讨
PHP code
@$judge=$_GET["speed"];
if(@$keyboard=$_GET["keyboard"]){
$keyboardfinal=100;
}
if(@$judge==1){
if($keyboard0){
@$keyboardfinal=50;
}
}
if(@$judge==2){
if(@$keyb……
声明:
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn