Array | |
( | |
[HTTP_HOST] => localhost | |
[HTTP_CONNECTION] => keep-alive | |
[HTTP_UPGRADE_INSECURE_REQUESTS] => 1 | |
[HTTP_USER_AGENT] => Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/62.0.3202.62 Safari/537.36 | |
[HTTP_ACCEPT] => text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8 | |
[HTTP_REFERER] => http://localhost/test/ | |
[HTTP_ACCEPT_ENCODING] => gzip, deflate, br | |
[HTTP_ACCEPT_LANGUAGE] => zh-CN,zh;q=0.9 | |
[HTTP_COOKIE] => | |
[PATH] => | |
[SystemRoot] => C:\WINDOWS | |
[COMSPEC] => C:\WINDOWS\system32\cmd.exe | |
[PATHEXT] => .COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC | |
[WINDIR] => C:\WINDOWS | |
[SERVER_SIGNATURE] => <address>Apache/2.4.27 (Win64) PHP/7.0.23 Server at localhost Port 80</address> | |
[SERVER_SOFTWARE] => Apache/2.4.27 (Win64) PHP/7.0.23 | |
[SERVER_NAME] => localhost | |
[SERVER_ADDR] => ::1 | |
[SERVER_PORT] => 80 | |
[REMOTE_ADDR] => ::1 | |
[DOCUMENT_ROOT] => C:/wamp64/bin/apache/apache2.4.27/htdocs | |
[REQUEST_SCHEME] => http | |
[CONTEXT_PREFIX] => | |
[CONTEXT_DOCUMENT_ROOT] => C:/wamp64/bin/apache/apache2.4.27/htdocs | |
[SERVER_ADMIN] => wampserver@wampserver.invalid | |
[SCRIPT_FILENAME] => C:/wamp64/bin/apache/apache2.4.27/htdocs/test/dirname.php | |
[REMOTE_PORT] => 61283 | |
[GATEWAY_INTERFACE] => CGI/1.1 | |
[SERVER_PROTOCOL] => HTTP/1.1 | |
[REQUEST_METHOD] => GET | |
[QUERY_STRING] => | |
[REQUEST_URI] => /test/dirname.php | |
[SCRIPT_NAME] => /test/dirname.php | |
[PHP_SELF] => /test/dirname.php | |
[REQUEST_TIME_FLOAT] => 1515487688.597 | |
[REQUEST_TIME] => 1515487688 | |
) 下面我记录一下我自己常用到的几个变量 1.$_SERVER['SERVER_NAME']:记录了网站的域名。 2.$_SERVER['DOCUMENT_ROOT']:网站的根目录(就是在你系统下的绝对路径,在windows都是例如是C://wamp/www之类的,linux例如是/var/www/html)。 3.$_SERVER['SERVER_ADDR']:记录网站的IP地址 4.$_SERVER['REMOTE_ADDR']:记录访问者的IP地址 5.$_SERVER['SCRIPT_FILENAME']:访问的文件的路径 6.$_SERVER['REQUEST_SCHEME']:访问的文件的方式,常见为http
|
php中$_SERVER 详解
最新推荐文章于 2021-03-12 06:39:13 发布