PHP:服务器变量列表
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了PHP:服务器变量列表相关的知识,希望对你有一定的参考价值。
Here's a pretty comprehensive list of Server variables I use.
//Information about the Server we're on echo "SERVER_NAME: " . $_SERVER['SERVER_NAME'] . "<br />"; echo "SERVER_ADDR: " . $_SERVER['SERVER_ADDR'] . "<br />"; echo "SERVER_PORT: " . $_SERVER['SERVER_PORT'] . "<br />"; echo "<br /><br />"; //Where are all the files located echo "DOCUMENT_ROOT: " . $_SERVER['DOCUMENT_ROOT'] . "<br />"; //Path on the URL Address bar //Path on the filesystem echo "SCRIPT_FILENAME: " . $_SERVER['SCRIPT_FILENAME'] . "<br />"; //Request details echo "REMOTE_ADDR: " . $_SERVER['REMOTE_ADDR'] . "<br />"; echo "REMOTE_Port: " . $_SERVER['REMOTE_PORT'] . "<br />"; echo "REQUEST_URI: " . $_SERVER['REQUEST_URI'] . "<br />"; echo "QUERY_STRING: " . $_SERVER['QUERY_STRING'] . "<br />"; echo "REMOTE_METHOD: " . $_SERVER['REQUEST_METHOD'] . "<br />"; echo "REMOTE_TIME: " . $_SERVER['REQUEST_TIME'] . "<br />"; //Who referred them to our website (YAHOO? GOOGLE?) echo "HTTP_REFERER: " . $_SERVER['HTTP_REFERER'] . "<br />"; //Statistics echo "HTTP_USER_AGENT: " . $_SERVER['HTTP_USER_AGENT'] . "<br />";
以上是关于PHP:服务器变量列表的主要内容,如果未能解决你的问题,请参考以下文章