神马 - 云代码空间
—— 任何傻瓜都能写出计算机可以理解的代码,好的程序员能写出人能读懂的代码。
<?php foreach ($_SERVER as $var => $value) { //遍历输出所有系统超级变量 echo "$var => $value <br />"; } ?>
用以上代码获取所有系统变量,可以看到系统变量$_SERVER[] 包括了:
HTTP_HOST HTTP_CONNECTION HTTP_CACHE_CONTROL HTTP_USER_AGENT HTTP_ACCEPT HTTP_ACCEPT_ENCODING HTTP_ACCEPT_LANGUAGE HTTP_ACCEPT_CHARSET HTTP_COOKIE PATH SystemRoot COMSPEC PATHEXT WINDIR SERVER_SIGNATURE SERVER_SOFTWARE SERVER_NAME SERVER_ADDR SERVER_PORT REMOTE_ADDR DOCUMENT_ROOT SERVER_ADMIN SCRIPT_FILENAME REMOTE_PORT GATEWAY_INTERFACE SERVER_PROTOCOL REQUEST_METHOD QUERY_STRING REQUEST_URI SCRIPT_NAME PHP_SELF REQUEST_TIME