reserved.variables.server.html

来自「php的帮助文档,涉及到PHP的案例和基本语法,以及实际应用内容」· HTML 代码 · 共 742 行 · 第 1/2 页

HTML
742
字号
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html> <head>  <title>Server and execution environment information</title>  <meta http-equiv="content-type" content="text/html; charset=UTF-8"> </head> <body><div style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="reserved.variables.globals.html">$GLOBALS</a></div> <div class="next" style="text-align: right; float: right;"><a href="reserved.variables.get.html">$_GET</a></div> <div class="up"><a href="reserved.variables.html">Predefined variables</a></div> <div class="home"><a href="index.html">PHP Manual</a></div></div><hr /><div id="reserved.variables.server" class="refentry"> <div class="refnamediv">  <h1 class="refname">$_SERVER</h1>  <h1 class="refname">$HTTP_SERVER_VARS [deprecated]</h1>  <p class="refpurpose"><span class="refname">$_SERVER</span> -- <span class="refname">$HTTP_SERVER_VARS [deprecated]</span> &mdash; <span class="dc-title">Server and execution environment information</span></p> </div>  <div class="refsect1 description">  <h3 class="title">Description</h3>  <p class="para">   <var class="varname">$_SERVER</var> is an array containing information   such as headers, paths, and script locations. The entries in this   array are created by the web server. There is no guarantee that   every web server will provide any of these; servers may omit some,   or provide others not listed here. That said, a large number of   these variables are accounted for in the <a href="http://hoohoo.ncsa.uiuc.edu/cgi/env.html" class="link external">&raquo; CGI 1.1 specification</a>, so you should   be able to expect those.  </p>  <p class="simpara">   <var class="varname">$HTTP_SERVER_VARS</var> contains the same initial   information, but is not a <a href="language.variables.superglobals.html" class="link">superglobal</a>.   (Note that <var class="varname">$HTTP_SERVER_VARS</var> and <var class="varname">$_SERVER</var>   are different variables and that PHP handles them as such)  </p>  <p class="simpara">   You may or may not find any of the following elements in   <var class="varname">$_SERVER</var>. Note that few, if any, of these will be   available (or indeed have any meaning) if running PHP on the   <a href="features.commandline.html" class="link">command line</a>.  </p>  <p class="para">   <dl>    <dt>     <span class="term">&#039;<var class="varname">PHP_SELF</var>&#039;</span>     <dd>      <span class="simpara">       The filename of the currently executing script, relative to       the document root. For instance,       <var class="varname">$_SERVER['PHP_SELF']</var> in a script at the       address <var class="filename">http://example.com/test.php/foo.bar</var>       would be <var class="filename">/test.php/foo.bar</var>.       The <a href="language.constants.predefined.html" class="link">__FILE__</a>       constant contains the full path and filename of the current (i.e.       included) file.      </span>      <span class="simpara">       If PHP is running as a command-line processor this variable contains       the script name since PHP 4.3.0. Previously it was not available.      </span>     </dd>    </dt>    <dt>     <span class="term">&#039;<a href="reserved.variables.argv.html" class="link">argv</a>&#039;</span>     <dd>      <span class="simpara">       Array of arguments passed to the script. When the script is       run on the command line, this gives C-style access to the       command line parameters. When called via the GET method, this       will contain the query string.      </span>     </dd>    </dt>    <dt>     <span class="term">&#039;<a href="reserved.variables.argc.html" class="link">argc</a>&#039;</span>     <dd>      <span class="simpara">       Contains the number of command line parameters passed to the       script (if run on the command line).      </span>     </dd>    </dt>    <dt>     <span class="term">&#039;<var class="varname">GATEWAY_INTERFACE</var>&#039;</span>     <dd>      <span class="simpara">       What revision of the CGI specification the server is using;       i.e. &#039;<i>CGI/1.1</i>&#039;.      </span>     </dd>    </dt>    <dt>     <span class="term">&#039;<var class="varname">SERVER_ADDR</var>&#039;</span>     <dd>      <span class="simpara">       The IP address of the server under which the current script is       executing.      </span>     </dd>    </dt>    <dt>     <span class="term">&#039;<var class="varname">SERVER_NAME</var>&#039;</span>     <dd>      <span class="simpara">       The name of the server host under which the current script is       executing. If the script is running on a virtual host, this       will be the value defined for that virtual host.      </span>     </dd>    </dt>    <dt>     <span class="term">&#039;<var class="varname">SERVER_SOFTWARE</var>&#039;</span>     <dd>      <span class="simpara">       Server identification string, given in the headers when       responding to requests.      </span>     </dd>    </dt>    <dt>     <span class="term">&#039;<var class="varname">SERVER_PROTOCOL</var>&#039;</span>     <dd>      <span class="simpara">       Name and revision of the information protocol via which the       page was requested; i.e. &#039;<i>HTTP/1.0</i>&#039;;      </span>     </dd>    </dt>        <dt>     <span class="term">&#039;<var class="varname">REQUEST_METHOD</var>&#039;</span>     <dd>      <span class="simpara">       Which request method was used to access the page; i.e. &#039;<i>GET</i>&#039;,       &#039;<i>HEAD</i>&#039;, &#039;<i>POST</i>&#039;, &#039;<i>PUT</i>&#039;.      </span>      <blockquote><p><b class="note">Note</b>:                PHP script is terminated after sending headers (it means after        producing any output without output buffering) if the request method        was <i>HEAD</i>.       <br />      </p></blockquote>     </dd>    </dt>    <dt>     <span class="term">&#039;<var class="varname">REQUEST_TIME</var>&#039;</span>     <dd>      <span class="simpara">       The timestamp of the start of the request. Available since PHP 5.1.0.      </span>     </dd>    </dt>    <dt>     <span class="term">&#039;<var class="varname">QUERY_STRING</var>&#039;</span>     <dd>      <span class="simpara">       The query string, if any, via which the page was accessed.      </span>     </dd>    </dt>    <dt>     <span class="term">&#039;<var class="varname">DOCUMENT_ROOT</var>&#039;</span>     <dd>      <span class="simpara">       The document root directory under which the current script is       executing, as defined in the server&#039;s configuration file.      </span>     </dd>    </dt>    <dt>     <span class="term">&#039;<var class="varname">HTTP_ACCEPT</var>&#039;</span>     <dd>      <span class="simpara">       Contents of the <i>Accept:</i> header from the       current request, if there is one.      </span>     </dd>    </dt>    <dt>     <span class="term">&#039;<var class="varname">HTTP_ACCEPT_CHARSET</var>&#039;</span>     <dd>      <span class="simpara">       Contents of the <i>Accept-Charset:</i> header       from the current request, if there is one. Example:       &#039;<i>iso-8859-1,*,utf-8</i>&#039;.      </span>     </dd>    </dt>    <dt>     <span class="term">&#039;<var class="varname">HTTP_ACCEPT_ENCODING</var>&#039;</span>     <dd>      <span class="simpara">       Contents of the <i>Accept-Encoding:</i> header       from the current request, if there is one. Example: &#039;<i>gzip</i>&#039;.      </span>     </dd>    </dt>        <dt>     <span class="term">&#039;<var class="varname">HTTP_ACCEPT_LANGUAGE</var>&#039;</span>     <dd>      <span class="simpara">       Contents of the <i>Accept-Language:</i> header       from the current request, if there is one. Example: &#039;<i>en</i>&#039;.      </span>     </dd>    </dt>        <dt>     <span class="term">&#039;<var class="varname">HTTP_CONNECTION</var>&#039;</span>     <dd>      <span class="simpara">       Contents of the <i>Connection:</i> header from       the current request, if there is one. Example: &#039;<i>Keep-Alive</i>&#039;.      </span>     </dd>    </dt>    <dt>     <span class="term">&#039;<var class="varname">HTTP_HOST</var>&#039;</span>     <dd>      <span class="simpara">       Contents of the <i>Host:</i> header from the       current request, if there is one.      </span>     </dd>    </dt>    <dt>     <span class="term">&#039;<var class="varname">HTTP_REFERER</var>&#039;</span>     <dd>      <span class="simpara">       The address of the page (if any) which referred the user       agent to the current page. This is set by the user agent. Not       all user agents will set this, and some provide the ability       to modify <var class="varname">HTTP_REFERER</var> as a feature. In       short, it cannot really be trusted.      </span>     </dd>    </dt>    <dt>     <span class="term">&#039;<var class="varname">HTTP_USER_AGENT</var>&#039;</span>     <dd>      <span class="simpara">       Contents of the <i>User-Agent:</i> header from       the current request, if there is one. This is a string       denoting the user agent being which is accessing the page. A       typical example is: <span class="computeroutput">Mozilla/4.5 [en] (X11; U;       Linux 2.2.9 i586)</span>. Among other things, you       can use this value with <a href="function.get-browser.html" class="function">get_browser()</a> to       tailor your page&#039;s output to the capabilities of the user       agent.      </span>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?