可以实用 _SERVER变量和_ENV变量
下面是我的phpinfo中的php变量:
_SERVER["SCRIPT_NAME"]
_SERVER["HTTP_COOKIE"]
_SERVER["AUTH_PASSWORD"]
_SERVER["AUTH_TYPE"]
_SERVER["AUTH_USER"]
_SERVER["CONTENT_LENGTH"]
_SERVER["CONTENT_TYPE"]
_SERVER["PATH_TRANSLATED"]
_SERVER["QUERY_STRING"]
_SERVER["REMOTE_ADDR"]
_SERVER["REMOTE_HOST"]
_SERVER["REMOTE_USER"]
_SERVER["REQUEST_METHOD"]
_SERVER["SERVER_NAME"]
_SERVER["SERVER_PORT"]
_SERVER["SERVER_PROTOCOL"]
_SERVER["SERVER_SOFTWARE"]
_SERVER["APPL_MD_PATH"]
_SERVER["APPL_PHYSICAL_PATH"]
_SERVER["INSTANCE_ID"]
_SERVER["INSTANCE_META_PATH"]
_SERVER["LOGON_USER"]
_SERVER["REQUEST_URI"]
_SERVER["URL"]
_SERVER["SCRIPT_FILENAME"]
_SERVER["ORIG_PATH_INFO"]
_SERVER["PATH_INFO"]
_SERVER["ORIG_PATH_TRANSLATED"]
_SERVER["DOCUMENT_ROOT"]
_SERVER["PHP_SELF"]
_SERVER["HTTP_CONNECTION"]
_SERVER["HTTP_KEEP_ALIVE"]
_SERVER["HTTP_HOST"]
_SERVER["HTTP_USER_AGENT"]
_SERVER["REQUEST_TIME"]
_SERVER["argv"]
Array
(
)
_SERVER["argc"]
_ENV["ALLUSERSPROFILE"]
_ENV["ClusterLog"]
_ENV["CommonProgramFiles"]
_ENV["COMPUTERNAME"]
_ENV["ComSpec"]
_ENV["FP_NO_HOST_CHECK"]
_ENV["NUMBER_OF_PROCESSORS"]
_ENV["OS"]
_ENV["Path"]
_ENV["PATHEXT"]
_ENV["PROCESSOR_ARCHITECTURE"]
_ENV["PROCESSOR_IDENTIFIER"]
_ENV["PROCESSOR_LEVEL"]
_ENV["PROCESSOR_REV