{"id":325,"date":"2013-11-05T10:10:44","date_gmt":"2013-11-05T02:10:44","guid":{"rendered":"http:\/\/www.zyuns.com\/?p=325"},"modified":"2015-02-15T20:47:16","modified_gmt":"2015-02-15T12:47:16","slug":"php-server-xiang-jie","status":"publish","type":"post","link":"https:\/\/www.siediyer.cn\/?p=325","title":{"rendered":"PHP $_SERVER\u8be6\u89e3"},"content":{"rendered":"<pre class=\"wrap:true lang:default decode:true \">&lt;?\n\/\/\u83b7\u53d6\u5f53\u524d\u7684\u57df\u540d:\necho $_SERVER['SERVER_NAME'];\n\/\/\u83b7\u53d6\u6765\u6e90\u7f51\u5740,\u5373\u70b9\u51fb\u6765\u5230\u672c\u9875\u7684\u4e0a\u9875\u7f51\u5740\necho $_SERVER[\"HTTP_REFERER\"];\n$_SERVER['REQUEST_URI'];\/\/\u83b7\u53d6\u5f53\u524d\u57df\u540d\u7684\u540e\u7f00\n$_SERVER['HTTP_HOST'];\/\/\u83b7\u53d6\u5f53\u524d\u57df\u540d\ndirname(__FILE__);\/\/\u83b7\u53d6\u5f53\u524d\u6587\u4ef6\u7684\u7269\u7406\u8def\u5f84\ndirname(__FILE__).\"\/..\/\";\/\/\u83b7\u53d6\u5f53\u524d\u6587\u4ef6\u7684\u4e0a\u4e00\u7ea7\u7269\u7406\u8def\u5f84\n?&gt;<\/pre>\n<p>&nbsp;<\/p>\n<pre class=\"wrap:true lang:default decode:true crayon-selected\">$_SERVER['HTTP_ACCEPT_LANGUAGE']\/\/\u6d4f\u89c8\u5668\u8bed\u8a00\n$_SERVER['REMOTE_ADDR'] \/\/\u5f53\u524d\u7528\u6237 IP \u3002\n$_SERVER['REMOTE_HOST'] \/\/\u5f53\u524d\u7528\u6237\u4e3b\u673a\u540d\n$_SERVER['REQUEST_URI'] \/\/URL\n\n$_SERVER['REMOTE_PORT'] \/\/\u7aef\u53e3\u3002\n$_SERVER['SERVER_NAME'] \/\/\u670d\u52a1\u5668\u4e3b\u673a\u7684\u540d\u79f0\u3002\n$_SERVER['PHP_SELF']\/\/\u6b63\u5728\u6267\u884c\u811a\u672c\u7684\u6587\u4ef6\u540d\n$_SERVER['argv'] \/\/\u4f20\u9012\u7ed9\u8be5\u811a\u672c\u7684\u53c2\u6570\u3002\n$_SERVER['argc'] \/\/\u4f20\u9012\u7ed9\u7a0b\u5e8f\u7684\u547d\u4ee4\u884c\u53c2\u6570\u7684\u4e2a\u6570\u3002\n$_SERVER['GATEWAY_INTERFACE']\/\/CGI \u89c4\u8303\u7684\u7248\u672c\u3002\n$_SERVER['SERVER_SOFTWARE'] \/\/\u670d\u52a1\u5668\u6807\u8bc6\u7684\u5b57\u4e32\n$_SERVER['SERVER_PROTOCOL'] \/\/\u8bf7\u6c42\u9875\u9762\u65f6\u901a\u4fe1\u534f\u8bae\u7684\u540d\u79f0\u548c\u7248\u672c\n$_SERVER['REQUEST_METHOD']\/\/\u8bbf\u95ee\u9875\u9762\u65f6\u7684\u8bf7\u6c42\u65b9\u6cd5\n$_SERVER['QUERY_STRING'] \/\/\u67e5\u8be2(query)\u7684\u5b57\u7b26\u4e32\u3002\n$_SERVER['DOCUMENT_ROOT'] \/\/\u5f53\u524d\u8fd0\u884c\u811a\u672c\u6240\u5728\u7684\u6587\u6863\u6839\u76ee\u5f55\n$_SERVER['HTTP_ACCEPT'] \/\/\u5f53\u524d\u8bf7\u6c42\u7684 Accept: \u5934\u90e8\u7684\u5185\u5bb9\u3002\n$_SERVER['HTTP_ACCEPT_CHARSET'] \/\/\u5f53\u524d\u8bf7\u6c42\u7684 Accept-Charset: \u5934\u90e8\u7684\u5185\u5bb9\u3002\n$_SERVER['HTTP_ACCEPT_ENCODING'] \/\/\u5f53\u524d\u8bf7\u6c42\u7684 Accept-Encoding: \u5934\u90e8\u7684\u5185\u5bb9\n$_SERVER['HTTP_CONNECTION'] \/\/\u5f53\u524d\u8bf7\u6c42\u7684 Connection: \u5934\u90e8\u7684\u5185\u5bb9\u3002\u4f8b\u5982\uff1a\u201cKeep-Alive\u201d\u3002\n$_SERVER['HTTP_HOST'] \/\/\u5f53\u524d\u8bf7\u6c42\u7684 Host: \u5934\u90e8\u7684\u5185\u5bb9\u3002\n$_SERVER['HTTP_REFERER'] \/\/\u94fe\u63a5\u5230\u5f53\u524d\u9875\u9762\u7684\u524d\u4e00\u9875\u9762\u7684 URL \u5730\u5740\u3002\n$_SERVER['HTTP_USER_AGENT'] \/\/\u5f53\u524d\u8bf7\u6c42\u7684 User_Agent: \u5934\u90e8\u7684\u5185\u5bb9\u3002\n$_SERVER['HTTPS']\/\/\u5982\u679c\u901a\u8fc7https\u8bbf\u95ee,\u5219\u88ab\u8bbe\u4e3a\u4e00\u4e2a\u975e\u7a7a\u7684\u503c(on)\uff0c\u5426\u5219\u8fd4\u56deoff\n$_SERVER['SCRIPT_FILENAME'] #\u5f53\u524d\u6267\u884c\u811a\u672c\u7684\u7edd\u5bf9\u8def\u5f84\u540d\u3002\n$_SERVER['SERVER_ADMIN'] #\u7ba1\u7406\u5458\u4fe1\u606f\n$_SERVER['SERVER_PORT'] #\u670d\u52a1\u5668\u6240\u4f7f\u7528\u7684\u7aef\u53e3\n$_SERVER['SERVER_SIGNATURE'] #\u5305\u542b\u670d\u52a1\u5668\u7248\u672c\u548c\u865a\u62df\u4e3b\u673a\u540d\u7684\u5b57\u7b26\u4e32\u3002\n$_SERVER['PATH_TRANSLATED'] #\u5f53\u524d\u811a\u672c\u6240\u5728\u6587\u4ef6\u7cfb\u7edf\uff08\u4e0d\u662f\u6587\u6863\u6839\u76ee\u5f55\uff09\u7684\u57fa\u672c\u8def\u5f84\u3002\n$_SERVER['SCRIPT_NAME'] #\u5305\u542b\u5f53\u524d\u811a\u672c\u7684\u8def\u5f84\u3002\u8fd9\u5728\u9875\u9762\u9700\u8981\u6307\u5411\u81ea\u5df1\u65f6\u975e\u5e38\u6709\u7528\u3002\n$_SERVER['PHP_AUTH_USER'] #\u5f53 PHP \u8fd0\u884c\u5728 Apache \u6a21\u5757\u65b9\u5f0f\u4e0b\uff0c\u5e76\u4e14\u6b63\u5728\u4f7f\u7528 HTTP \u8ba4\u8bc1\u529f\u80fd\uff0c\u8fd9\u4e2a\u53d8\u91cf\u4fbf\u662f\u7528\u6237\u8f93\u5165\u7684\u7528\u6237\u540d\u3002\n$_SERVER['PHP_AUTH_PW'] #\u5f53 PHP \u8fd0\u884c\u5728 Apache \u6a21\u5757\u65b9\u5f0f\u4e0b\uff0c\u5e76\u4e14\u6b63\u5728\u4f7f\u7528 HTTP \u8ba4\u8bc1\u529f\u80fd\uff0c\u8fd9\u4e2a\u53d8\u91cf\u4fbf\u662f\u7528\u6237\u8f93\u5165\u7684\u5bc6\u7801\u3002\n$_SERVER['AUTH_TYPE'] #\u5f53 PHP \u8fd0\u884c\u5728 Apache \u6a21\u5757\u65b9\u5f0f\u4e0b\uff0c\u5e76\u4e14\u6b63\u5728\u4f7f\u7528 HTTP \u8ba4\u8bc1\u529f\u80fd\uff0c\u8fd9\u4e2a\u53d8\u91cf\u4fbf\u662f\u8ba4\u8bc1\u7684\u7c7b\u578b<\/pre>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>&lt;? \/\/\u83b7\u53d6\u5f53\u524d\u7684\u57df\u540d: echo $_SERVER[&#8216;SERVER_NAME&#8217;]; \/\/\u83b7\u53d6\u6765\u6e90\u7f51\u5740 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[],"class_list":["post-325","post","type-post","status-publish","format-standard","hentry","category-php"],"_links":{"self":[{"href":"https:\/\/www.siediyer.cn\/index.php?rest_route=\/wp\/v2\/posts\/325","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.siediyer.cn\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.siediyer.cn\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.siediyer.cn\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.siediyer.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=325"}],"version-history":[{"count":1,"href":"https:\/\/www.siediyer.cn\/index.php?rest_route=\/wp\/v2\/posts\/325\/revisions"}],"predecessor-version":[{"id":427,"href":"https:\/\/www.siediyer.cn\/index.php?rest_route=\/wp\/v2\/posts\/325\/revisions\/427"}],"wp:attachment":[{"href":"https:\/\/www.siediyer.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=325"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.siediyer.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=325"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.siediyer.cn\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=325"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}