{"id":86,"date":"2023-06-05T13:00:52","date_gmt":"2023-06-05T05:00:52","guid":{"rendered":"http:\/\/pro369.com\/php\/?p=86"},"modified":"2019-04-16T16:10:03","modified_gmt":"2019-04-16T16:10:03","slug":"php%e4%b8%ad%24-server%e7%9a%84%e8%a9%b3%e7%b4%b0%e5%8f%83%e6%95%b8%e5%8f%8a%e8%aa%aa%e6%98%8e","status":"publish","type":"post","link":"https:\/\/por.tw\/php\/php%e4%b8%ad%24-server%e7%9a%84%e8%a9%b3%e7%b4%b0%e5%8f%83%e6%95%b8%e5%8f%8a%e8%aa%aa%e6%98%8e\/","title":{"rendered":"PHP\u4e2d$_SERVER\u7684\u8a73\u7d30\u53c3\u6578\u53ca\u8aaa\u660e"},"content":{"rendered":"<p><font size=\"3\" style=\"background-color: #ffff00\"><strong>PHP\u5beb\u7a0b\u5f0f\u4e2d\u7d93\u5e38\u9700\u8981\u7528\u5230\u4e00\u4e9b\u4f3a\u670d\u5668\u7684\u4e00\u4e9b\u8cc7\u6599\uff0c\u7279\u628a$_SERVER\u7684\u8a73\u7d30\u53c3\u6578\u6574\u7406\u4e0b\uff0c\u65b9\u4fbf\u4ee5\u5f8c\u4f7f\u7528\u3002<\/strong><\/font><br \/> $_SERVER[&#39;PHP_SELF&#39;] #\u73fe\u7528\u7684\u6b63\u5728\u57f7\u884c\u8173\u672c\u7684\u6a94\u540d\uff0c\u8207 document root\u95dc\u806f\u3002&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;<br \/> $_SERVER[&#39;argv&#39;] #\u50b3\u905e\u7d66\u8a72\u8173\u672c\u7684\u53c3\u6578\u3002&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;<br \/> $_SERVER[&#39;argc&#39;] #\u5305\u62ec\u50b3\u905e\u7d66\u7a0b\u5f0f\u7684\u6307\u4ee4\u884c\u53c3\u6578\u7684\u500b\u6578\uff08\u5982\u679c\u904b\u884c\u5728\u6307\u4ee4\u884c\u6a21\u5f0f\uff09\u3002&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;<br \/> $_SERVER[&#39;GATEWAY_INTERFACE&#39;] #\u4f3a\u670d\u5668\u4f7f\u7528\u7684 CGI \u898f\u7bc4\u7684\u7248\u672c\u3002\u4f8b\u5982\uff0c\u300cCGI\/1.1\u300d\u3002&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;<br \/> $_SERVER[&#39;SERVER_NAME&#39;] #\u73fe\u7528\u7684\u904b\u884c\u8173\u672c\u6240\u5728\u4f3a\u670d\u5668\u4e3b\u96fb\u8166\u7684\u540d\u7a31\u3002&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;<br \/> $_SERVER[&#39;SERVER_SOFTWARE&#39;] #\u4f3a\u670d\u5668\u6a19\u8b58\u7684\u5b57\u4e32\uff0c\u5728\u97ff\u61c9\u8acb\u6c42\u6642\u7684\u982d\u90e8\u4e2d\u7d66\u51fa\u3002&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;<br \/> $_SERVER[&#39;SERVER_PROTOCOL&#39;] #\u8acb\u6c42\u9801\u9762\u6642\u901a\u4fe1\u5354\u5b9a\u7684\u540d\u7a31\u548c\u7248\u672c\u3002\u4f8b\u5982\uff0c\u300cHTTP\/1.0\u300d\u3002&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;<br \/> $_SERVER[&#39;REQUEST_METHOD&#39;] #\u8a2a\u554f\u9801\u9762\u6642\u7684\u8acb\u6c42\u65b9\u6cd5\u3002\u4f8b\u5982\uff1a\u300cGET\u300d\u3001\u300cHEAD\u300d\uff0c\u300cPOST\u300d\uff0c\u300cPUT\u300d\u3002&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;<br \/> $_SERVER[&#39;QUERY_STRING&#39;] #\u67e5\u8a62(query)\u7684\u5b57\u4e32\u3002&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;<br \/> $_SERVER[&#39;DOCUMENT_ROOT&#39;] #\u73fe\u7528\u7684\u904b\u884c\u8173\u672c\u6240\u5728\u7684\u6587\u4ef6\u6839\u76ee\u9304\u3002\u5728\u4f3a\u670d\u5668\u914d\u7f6e\u6a94\u6848\u4e2d\u5b9a\u7fa9\u3002&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;<br \/> $_SERVER[&#39;HTTP_ACCEPT&#39;] #\u73fe\u7528\u7684\u8acb\u6c42\u7684 Accept: \u982d\u90e8\u7684\u5167\u5bb9\u3002&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;<br \/> $_SERVER[&#39;HTTP_ACCEPT_CHARSET&#39;] #\u73fe\u7528\u7684\u8acb\u6c42\u7684 Accept-Charset: \u982d\u90e8\u7684\u5167\u5bb9\u3002\u4f8b\u5982\uff1a\u300ciso-8859-1,*,utf-8\u300d\u3002&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;<br \/> $_SERVER[&#39;HTTP_ACCEPT_ENCODING&#39;] #\u73fe\u7528\u7684\u8acb\u6c42\u7684 Accept-Encoding: \u982d\u90e8\u7684\u5167\u5bb9\u3002\u4f8b\u5982\uff1a\u300cgzip\u300d\u3002&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;<br \/> $_SERVER[&#39;HTTP_ACCEPT_LANGUAGE&#39;]#\u73fe\u7528\u7684\u8acb\u6c42\u7684 Accept-Language: \u982d\u90e8\u7684\u5167\u5bb9\u3002\u4f8b\u5982\uff1a\u300cen\u300d\u3002&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;<br \/> $_SERVER[&#39;HTTP_CONNECTION&#39;] #\u73fe\u7528\u7684\u8acb\u6c42\u7684 Connection: \u982d\u90e8\u7684\u5167\u5bb9\u3002\u4f8b\u5982\uff1a\u300cKeep-Alive\u300d\u3002&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;<br \/> $_SERVER[&#39;HTTP_HOST&#39;] #\u73fe\u7528\u7684\u8acb\u6c42\u7684 Host: \u982d\u90e8\u7684\u5167\u5bb9\u3002&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;<br \/> $_SERVER[&#39;HTTP_REFERER&#39;] #\u9023\u7d50\u5230\u73fe\u7528\u7684\u9801\u9762\u7684\u524d\u4e00\u9801\u9762\u7684 URL \u4f4d\u5740\u3002&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;<br \/> $_SERVER[&#39;HTTP_USER_AGENT&#39;] #\u73fe\u7528\u7684\u8acb\u6c42\u7684 User_Agent: \u982d\u90e8\u7684\u5167\u5bb9\u3002&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;<br \/> $_SERVER[&#39;HTTPS&#39;] &mdash; \u5982\u679c\u901a\u904ehttps\u8a2a\u554f,\u5247\u88ab\u8a2d\u70ba\u4e00\u500b\u975e\u7a7a\u7684\u503c(on)\uff0c\u5426\u5247\u8fd4\u56deoff&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;<br \/> $_SERVER[&#39;REMOTE_ADDR&#39;] #\u6b63\u5728\u700f\u89bd\u73fe\u7528\u7684\u9801\u9762\u4f7f\u7528\u8005\u7684 IP \u4f4d\u5740\u3002&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;<br \/> $_SERVER[&#39;REMOTE_HOST&#39;] #\u6b63\u5728\u700f\u89bd\u73fe\u7528\u7684\u9801\u9762\u4f7f\u7528\u8005\u7684\u4e3b\u96fb\u8166\u540d\u3002&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;<br \/> $_SERVER[&#39;REMOTE_PORT&#39;] #\u4f7f\u7528\u8005\u9023\u7dda\u5230\u4f3a\u670d\u5668\u6642\u6240\u4f7f\u7528\u7684\u9023\u63a5\u57e0\u3002&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;<br \/> $_SERVER[&#39;SCRIPT_FILENAME&#39;] #\u73fe\u7528\u7684\u57f7\u884c\u8173\u672c\u7684\u7d55\u5c0d\u8def\u5f91\u540d\u3002&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;<br \/> $_SERVER[&#39;SERVER_ADMIN&#39;] #\u7ba1\u7406\u54e1\u8a0a\u606f&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;<br \/> $_SERVER[&#39;SERVER_PORT&#39;] #\u4f3a\u670d\u5668\u6240\u4f7f\u7528\u7684\u9023\u63a5\u57e0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;<br \/> $_SERVER[&#39;SERVER_SIGNATURE&#39;] #\u5305\u62ec\u4f3a\u670d\u5668\u7248\u672c\u548c\u865b\u64ec\u4e3b\u96fb\u8166\u540d\u7684\u5b57\u4e32\u3002&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;<br \/> $_SERVER[&#39;PATH_TRANSLATED&#39;] #\u73fe\u7528\u7684\u8173\u672c\u6240\u5728\u6a94\u6848\u7cfb\u7d71\uff08\u4e0d\u662f\u6587\u4ef6\u6839\u76ee\u9304\uff09\u7684\u57fa\u672c\u8def\u5f91\u3002&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;<br \/> $_SERVER[&#39;SCRIPT_NAME&#39;] #\u5305\u62ec\u73fe\u7528\u7684\u8173\u672c\u7684\u8def\u5f91\u3002\u9019\u5728\u9801\u9762\u9700\u8981\u6307\u5411\u81ea\u5df1\u6642\u975e\u5e38\u6709\u7528\u3002&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;<br \/> $_SERVER[&#39;REQUEST_URI&#39;] #\u8a2a\u554f\u6b64\u9801\u9762\u6240\u9700\u7684 URI\u3002\u4f8b\u5982\uff0c\u300c\/index.html\u300d\u3002&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;<br \/> $_SERVER[&#39;PHP_AUTH_USER&#39;] #\u7576 PHP \u904b\u884c\u5728 Apache \u6a21\u7d44\u6a21\u5f0f\u4e0b\uff0c\u4e26\u4e14\u6b63\u5728\u4f7f\u7528 HTTP \u8a8d\u8b49\u529f\u80fd\uff0c\u9019\u500b\u8b8a\u91cf\u4fbf\u662f\u4f7f\u7528\u8005\u8f38\u5165\u7684\u4f7f\u7528\u8005\u540d\u3002&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;<br \/> $_SERVER[&#39;PHP_AUTH_PW&#39;] #\u7576 PHP \u904b\u884c\u5728 Apache \u6a21\u7d44\u6a21\u5f0f\u4e0b\uff0c\u4e26\u4e14\u6b63\u5728\u4f7f\u7528 HTTP \u8a8d\u8b49\u529f\u80fd\uff0c\u9019\u500b\u8b8a\u91cf\u4fbf\u662f\u4f7f\u7528\u8005\u8f38\u5165\u7684\u5bc6\u78bc\u3002&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;<br \/> $_SERVER[&#39;AUTH_TYPE&#39;] #\u7576 PHP \u904b\u884c\u5728 Apache \u6a21\u7d44\u6a21\u5f0f\u4e0b\uff0c\u4e26\u4e14\u6b63\u5728\u4f7f\u7528 HTTP \u8a8d\u8b49\u529f\u80fd\uff0c\u9019\u500b\u8b8a\u91cf\u4fbf\u662f\u8a8d\u8b49\u7684\u985e\u578b\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>PHP\u5beb\u7a0b\u5f0f\u4e2d\u7d93\u5e38\u9700\u8981\u7528\u5230\u4e00\u4e9b\u4f3a\u670d\u5668\u7684\u4e00\u4e9b\u8cc7\u6599\uff0c\u7279\u628a$_SERVER\u7684\u8a73\u7d30\u53c3\u6578\u6574\u7406\u4e0b\uff0c\u65b9\u4fbf\u4ee5\u5f8c\u4f7f\u7528\u3002 $_SE [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":381,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8],"tags":[22],"class_list":["post-86","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-php","tag-php"],"_links":{"self":[{"href":"https:\/\/por.tw\/php\/wp-json\/wp\/v2\/posts\/86"}],"collection":[{"href":"https:\/\/por.tw\/php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/por.tw\/php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/por.tw\/php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/por.tw\/php\/wp-json\/wp\/v2\/comments?post=86"}],"version-history":[{"count":0,"href":"https:\/\/por.tw\/php\/wp-json\/wp\/v2\/posts\/86\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/por.tw\/php\/wp-json\/wp\/v2\/media\/381"}],"wp:attachment":[{"href":"https:\/\/por.tw\/php\/wp-json\/wp\/v2\/media?parent=86"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/por.tw\/php\/wp-json\/wp\/v2\/categories?post=86"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/por.tw\/php\/wp-json\/wp\/v2\/tags?post=86"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}