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

关于php获取变量有关问题

Jun 13, 2016 pm 01:27 PM
amp keyboard quot

关于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……
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

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

Repo: How To Revive Teammates
1 months ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
1 months ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Valve prohibits new keyboard features Razer Snap Tap and Wooting Snappy Tappy in Counter-Strike 2 Valve prohibits new keyboard features Razer Snap Tap and Wooting Snappy Tappy in Counter-Strike 2 Aug 20, 2024 pm 09:46 PM

Razer recently introduced the Snap Tap feature for perfect counter-strafing on the Huntsman V3 Pro keyboards, and Wooting responded to community requests with Snappy Tappy (formerly SOCD). These hardware-based keyboard features make it easier to coor

php提交表单通过后,弹出的对话框怎样在当前页弹出,该如何解决 php提交表单通过后,弹出的对话框怎样在当前页弹出,该如何解决 Jun 13, 2016 am 10:23 AM

php提交表单通过后,弹出的对话框怎样在当前页弹出php提交表单通过后,弹出的对话框怎样在当前页弹出而不是在空白页弹出?想实现这样的效果:而不是空白页弹出:------解决方案--------------------如果你的验证用PHP在后端,那么就用Ajax;仅供参考:HTML code

What coin is AMP? What coin is AMP? Feb 24, 2024 pm 09:16 PM

What is AMP Coin? The AMP token was created by the Synereo team in 2015 as the main trading currency of the Synereo platform. AMP token aims to provide users with a better digital economic experience through multiple functions and uses. Purpose of AMP Token The AMP Token has multiple roles and functions in the Synereo platform. First, as part of the platform’s cryptocurrency reward system, users are able to earn AMP rewards by sharing and promoting content, a mechanism that encourages users to participate more actively in the platform’s activities. AMP tokens can also be used to promote and distribute content on the Synereo platform. Users can increase the visibility of their content on the platform by using AMP tokens to attract more viewers to view and share

Logitech launches Keys-To-Go 2 ultra-slim keyboard with folding cover as Magic Keyboard alternative Logitech launches Keys-To-Go 2 ultra-slim keyboard with folding cover as Magic Keyboard alternative Jun 21, 2024 am 06:46 AM

While integrated keyboard cases for iPad have their obvious advantages, there are downsides too, such as the added weight and bulk to an otherwise thin tablet, and the inability to use it with other devices, or even other iPad versions. Logitech’s ne

Apple IIGS keyboard from 1986 gets wireless connectivity, OLED display in DIY project Apple IIGS keyboard from 1986 gets wireless connectivity, OLED display in DIY project Sep 28, 2024 am 06:07 AM

Retro mechanical keyboards are all the rage these days, with the likes of the IBM Model M — although not technically mechanical — having gone from e-waste to veritable geek gold in recent years. However, the Model M isn't the only attractive keyboard

Modder converts 1986 Apple IIGS keyboard to wireless with impeccable reverse engineering and modern features Modder converts 1986 Apple IIGS keyboard to wireless with impeccable reverse engineering and modern features Sep 27, 2024 pm 03:02 PM

Retro mechanical keyboards are all the rage these days, with the likes of the IBM Model M — although not technically mechanical — having gone from e-waste to veritable geek gold in recent years. However, the Model M isn't the only attractive keyboard

Deal | Woot! sale slahes prices on Keychron mechanical keyboards with Gateron G Pro switches and QMK, VIA support to as low as $44.99 — up to 63% off Deal | Woot! sale slahes prices on Keychron mechanical keyboards with Gateron G Pro switches and QMK, VIA support to as low as $44.99 — up to 63% off Sep 22, 2024 am 06:15 AM

Getting started in a hobby like mechanical keyboards can be rather daunting at first. There are almost too many options to choose from, and many of the most popular recommended brands on sites like Reddit are exorbitantly expensive. Fortunately, a li

不用数据库来实现用户的简单的下载,代码如下,但是却不能下载,请高手找下原因,文件路劲什么的没有关问题 不用数据库来实现用户的简单的下载,代码如下,但是却不能下载,请高手找下原因,文件路劲什么的没有关问题 Jun 13, 2016 am 10:15 AM

不用数据库来实现用户的简单的下载,代码如下,但是却不能下载,请高手找下原因,文件路劲什么的没问题。

See all articles