$_SERVER 是一个包含了诸如头信息(header)、路径(path)、以及脚本位置(script locations)等等信息的数组。这个数组中的项目由 Web 服务器创建。不能保证每个服务器都提供全部项目;服务器可能会忽略一些,或者提供一些没有在这里列举出来的项目。 [1]
<?php foreach ($_SERVER as $key => $value) { var_dump($key . ‘===‘ . $value. ‘<br/>‘); } ?>
" string(31) "DOCUMENT_ROOT===D:\CRMEB26 " string(22) "REMOTE_ADDR===::1 " string(24) "REMOTE_PORT===59715 " string(52) "SERVER_SOFTWARE===PHP 7.2.19 Development Server " string(31) "SERVER_PROTOCOL===HTTP/1.1 " string(28) "SERVER_NAME===localhost " string(23) "SERVER_PORT===8899 " string(20) "REQUEST_URI===/ " string(25) "REQUEST_METHOD===GET " string(29) "SCRIPT_NAME===/index.php " string(43) "SCRIPT_FILENAME===D:\CRMEB26\index.php " string(26) "PHP_SELF===/index.php " string(31) "HTTP_HOST===localhost:8899 " string(33) "HTTP_CONNECTION===keep-alive " string(35) "HTTP_CACHE_CONTROL===max-age=0 " string(39) "HTTP_UPGRADE_INSECURE_REQUESTS===1 " string(132) "HTTP_USER_AGENT===Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.100 Safari/537.36 " string(137) "HTTP_ACCEPT===text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3 " string(45) "HTTP_ACCEPT_ENCODING===gzip, deflate, br " string(51) "HTTP_ACCEPT_LANGUAGE===zh-CN,zh;q=0.9,en;q=0.8 " string(131) "HTTP_COOKIE===csrftoken=TG7fqm9L2hILFvXSBtTUTClPCytNFRJC151V209BZQ1ENL5mrSRcebdSnMtA1GfS; PHPSESSID=jsnl3bmm3ljtchbt7e2pgt7emo " string(41) "REQUEST_TIME_FLOAT===1563240933.4171 " string(30) "REQUEST_TIME===1563240933
原文地址:https://www.cnblogs.com/aguncn/p/11192981.html
时间: 2024-10-29 21:56:29