URL传值的时候,用的GET方法,里面的参数大小写问题。

WBOY
Release: 2016-06-20 12:34:26
Original
2704 people have browsed it

比如list.php?USERID=1
我取值的时候必须是$_GET["USERID"],用$_GET["userid"]就取不到值。什么地方可以设置吗?


回复讨论(解决方案)

那你url的参数就直接小写好了。。。  怕用户误输入  大小不一 那就强行全转成小写的

没有地方设置,因为 php 的变量(关联键)是区分大小写的
比如 $A 和 $a 就是两个变量

不过你可以用 array_change_key_case 函数将数组的关联键改成全为小写或大写的

$input_array = array("FirSt" => 1, "SecOnd" => 4);print_r(array_change_key_case($input_array, CASE_LOWER));
Copy after login
Array(    [first] => 1    [second] => 4)
Copy after login

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