用for循环出$_SERVER超级变量的值:
- <?php
- foreach($_SERVER as $names =>$values) {
- echo '$_SERVER["''.$names.'"']='.$values.'<br/>';
- }
- ?>
结果:
$_SERVER[color=#0000ff]['HTTP_ACCEPT']=*/*
$_SERVER['HTTP_ACCEPT_LANGUAGE']=zh-cn
$_SERVER['HTTP_UA_CPU']=x86
$_SERVER['HTTP_ACCEPT_ENCODING']=gzip, deflate
$_SERVER['HTTP_USER_AGENT']=Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; SV1; Mozilla/4.0(Compatible Mozilla/4.0(Compatible-EmbeddedWB 14.59 http://bsalsa.com/ EmbeddedWB- 14.59 from: http://bsalsa.com/ ; .NET CLR 1.1.4322)
$_SERVER['HTTP_HOST']=localhost
$_SERVER['HTTP_CONNECTION']=Keep-Alive
$_SERVER['HTTP_COOKIE']=PHPSESSID=ic8nrqpns9kt3spdg0h99ofkc1
$_SERVER['PATH']=c:"windows"system32;c:"windows;c:"windows"system32"WBEM;c:"sybase"bin;c:"sybase"dll;D:"MPlayer
$_SERVER['SystemRoot']=C:"WINDOWS
$_SERVER['COMSPEC']=C:"WINDOWS"system32"cmd.exe
$_SERVER['PATHEXT']=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH
$_SERVER['WINDIR']=C:"WINDOWS
$_SERVER['SERVER_SIGNATURE']=
$_SERVER['SERVER_SOFTWARE']=Apache/2.2.8 (Win32) PHP/5.2.5
$_SERVER['SERVER_NAME']=localhost
$_SERVER['SERVER_ADDR']=127.0.0.1
$_SERVER['SERVER_PORT']=80
$_SERVER['REMOTE_ADDR']=127.0.0.1
$_SERVER['DOCUMENT_ROOT']=D:/SERVER/wwwroot
$_SERVER['SERVER_ADMIN']=0758jian@163.com
$_SERVER['SCRIPT_FILENAME']=D:/SERVER/wwwroot/demo/ip.php
$_SERVER['REMOTE_PORT']=1379
$_SERVER['GATEWAY_INTERFACE']=CGI/1.1
$_SERVER['SERVER_PROTOCOL']=HTTP/1.1
$_SERVER['REQUEST_METHOD']=GET
$_SERVER['QUERY_STRING']=
$_SERVER['REQUEST_URI']=/demo/ip.php
$_SERVER['SCRIPT_NAME']=/demo/ip.php
$_SERVER['PHP_SELF']=/demo/ip.php
$_SERVER['REQUEST_TIME']=1226885717