首页 > 代码库 > php $_SERVER 中的 QUERY_STRING和REQUEST_URI
php $_SERVER 中的 QUERY_STRING和REQUEST_URI
index.php
<?php print_r($_GET); parse_str($_SERVER[‘QUERY_STRING‘],$get); print_r($get); print_r($_SERVER); ?>
输出:
Array ( [a_a] => 1 [b] => 2 ) Array ( [a_a] => 1 [b] => 2 ) Array ( [HTTP_HOST] => www.my.com [HTTP_CONNECTION] => keep-alive [HTTP_UPGRADE_INSECURE_REQUESTS] => 1 [HTTP_USER_AGENT] => Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.115 Safari/537.36 [HTTP_ACCEPT] => text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8 [HTTP_ACCEPT_ENCODING] => gzip, deflate [HTTP_ACCEPT_LANGUAGE] => zh-CN,zh;q=0.8 [PATH] => C:\ProgramData\Oracle\Java\javapath;C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\;C:\Program Files\TortoiseSVN\bin;C:\Program Files\Java\jdk1.8.0_131\bin;D:\python2.7;C:\Windows\system32\config\systemprofile\AppData\Local\Microsoft\WindowsApps [SystemRoot] => C:\Windows [COMSPEC] => C:\Windows\system32\cmd.exe [PATHEXT] => .COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC [WINDIR] => C:\Windows [SERVER_SIGNATURE] => <address>Apache/2.4.23 (Win64) PHP/5.6.25 Server at www.my.com Port 80</address> [SERVER_SOFTWARE] => Apache/2.4.23 (Win64) PHP/5.6.25 [SERVER_NAME] => www.my.com [SERVER_ADDR] => 127.0.0.1 [SERVER_PORT] => 80 [REMOTE_ADDR] => 127.0.0.1 [DOCUMENT_ROOT] => D:/wamp64/www/my [REQUEST_SCHEME] => http [CONTEXT_PREFIX] => [CONTEXT_DOCUMENT_ROOT] => D:/wamp64/www/my [SERVER_ADMIN] => wampserver@wampserver.invalid [SCRIPT_FILENAME] => D:/wamp64/www/my/index.php [REMOTE_PORT] => 49956 [GATEWAY_INTERFACE] => CGI/1.1 [SERVER_PROTOCOL] => HTTP/1.1 [REQUEST_METHOD] => GET [QUERY_STRING] => a.a=1&b=2 [REQUEST_URI] => /index.php?a.a=1&b=2 [SCRIPT_NAME] => /index.php [PHP_SELF] => /index.php [REQUEST_TIME_FLOAT] => 1500294863.765 [REQUEST_TIME] => 1500294863 )
变量名中的点和空格被转换成下划线。例如 <input name="a.b" /> 变成了 $_REQUEST["a_b"]。
php $_SERVER 中的 QUERY_STRING和REQUEST_URI
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。