PHP地址栏输入也区分大小写吗

WBOY
Release: 2016-06-23 13:26:25
Original
803 people have browsed it

aa.php文件如下:
        @$PID = 0;
@$PID = $_GET["ID"];
echo @$PID;
?>
如果在地址栏中输入的是aa.php?id=1,则取不到这个值,即输出为空,如果输入的是aa.php?ID=1,则可以取到这个值,输出1
这是怎么回事,地址栏也区分大小写吗?


回复讨论(解决方案)

php 的变量名(包括数组的关联键,类的属性名)是区分大小写的

如果是需要用户自己输入地址栏内容,那不可能规定用户必须输入小写或大写啊,在程序里怎么处理???

如果是需要用户自己输入地址栏内容,那不可能规定用户必须输入小写或大写啊,在程序里怎么处理???


用函数strtolower或者strtoupper
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