$_SERVER 变量的使用
PHP编程中经常需要用到一些服务器的一些资料,可以通过$_SERVER来获取
print_r($_SERVER);
打印结果:
[HTTP_ACCEPT] => */* [HTTP_ACCEPT_LANGUAGE] => zh-cn [HTTP_ACCEPT_ENCODING] => gzip, deflate [HTTP_USER_AGENT] => Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; Trident/4.0) [HTTP_HOST] => localhost [HTTP_CONNECTION] => Keep-Alive [HTTP_COOKIE] => PHPSESSID=e19d7b71bc8548f3ae72ecb78d35269d [PATH] => C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Program Files\Java\jdk1.6.0_11\bin;C:\Program Files\Java\jdk1.6.0_11\jre\bin;C:\Program Files\TortoiseSVN\bin [SystemRoot] => C:\WINDOWS [COMSPEC] => C:\WINDOWS\system32\cmd.exe [PATHEXT] => .COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH [WINDIR] => C:\WINDOWS [SERVER_SIGNATURE] =>
Apache/2.2.8 (Win32) PHP/5.2.6 Server at localhost Port 80[SERVER_SOFTWARE] => Apache/2.2.8 (Win32) PHP/5.2.6 [SERVER_NAME] => localhost [SERVER_ADDR] => 127.0.0.1 [SERVER_PORT] => 80 [REMOTE_ADDR] => 127.0.0.1 [DOCUMENT_ROOT] => D:/AppServ2510/www [SERVER_ADMIN] => theemail@sohu.com [SCRIPT_FILENAME] => D:/AppServ2510/www/qthinker/weijingtai/content.php [REMOTE_PORT] => 2278 [GATEWAY_INTERFACE] => CGI/1.1 [SERVER_PROTOCOL] => HTTP/1.1 [REQUEST_METHOD] => GET [QUERY_STRING] => [REQUEST_URI] => /qthinker/weijingtai/content.php [SCRIPT_NAME] => /qthinker/weijingtai/content.php [PHP_SELF] => /qthinker/weijingtai/content.php [REQUEST_TIME] => 1350907194