Home >Backend Development >PHP Tutorial >关于php获取变量有关问题

关于php获取变量有关问题

WBOY
WBOYOriginal
2016-06-13 10:28:33879browse

关于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……
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn