关于php获取变量有关问题

WBOY
Release: 2016-06-13 13:27:04
Original
938 people have browsed it

关于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;
    }
Copy after login

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


------解决方案--------------------
@$judge=$_GET["speed"];
为什么变量前面加@有什么特别效果吗?
------解决方案--------------------
不明白楼主为什么要加那么多错误控制符,如果不报出错误,你怎么修改代码呢?
将楼主的代码修改了下:
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>
Copy after login
探讨
PHP code
@$judge=$_GET["speed"];
if(@$keyboard=$_GET["keyboard"]){
$keyboardfinal=100;
}
if(@$judge==1){
if($keyboard0){
@$keyboardfinal=50;
}
}
if(@$judge==2){
if(@$keyb……
Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template