cvs: phpdoc /en language-snippets.ent /en/appendices reserved.xml /en/language variables.xml /en/language/predefined variables.xml
/en/language/predefined/variables argc.xml argv.xml cookie.xml env.xml files.xml get.xml globals.xml httprawpostdata.xml httpresponseheader.xml
phperrormsg.xml post.xml request.xml server.xml session.xml
| From: | Hannes Magnusson | Date: | Mon, 14 Apr 2008 17:28:03 +0000 |
| Subject: | cvs: phpdoc /en language-snippets.ent /en/appendices reserved.xml /en/language variables.xml /en/language/predefined variables.xml /en/language/predefined/variables argc.xml argv.xml cookie.xml env.xml files.xml get.xml globals.xml httprawpostdata.xml httpresponseheader.xml phperrormsg.xml post.xml request.xml server.xml session.xml |
||
| Groups: | php.doc.cvs | ||
| Request: | Send a blank email to doc-cvs+get-1502@lists.php.net to get a copy of this message | ||
bjori Mon Apr 14 17:28:03 2008 UTC
Added files:
/phpdoc/en/language/predefined variables.xml
/phpdoc/en/language/predefined/variables argc.xml argv.xml
cookie.xml env.xml
files.xml get.xml
globals.xml
httprawpostdata.xml
httpresponseheader.xml
phperrormsg.xml post.xml
request.xml server.xml
session.xml
Modified files:
/phpdoc/en language-snippets.ent
/phpdoc/en/appendices reserved.xml
/phpdoc/en/language variables.xml
Log:
Refactor predefined PHP varibles
(90% cut&paste, almost no new content except for examples maybe)
http://cvs.php.net/viewvc.cgi/phpdoc/en/language-snippets.ent?r1=1.219&r2=1.220&diff_format=u Index: phpdoc/en/language-snippets.ent diff -u phpdoc/en/language-snippets.ent:1.219 phpdoc/en/language-snippets.ent:1.220 --- phpdoc/en/language-snippets.ent:1.219 Tue Mar 25 03:21:33 2008 +++ phpdoc/en/language-snippets.ent Mon Apr 14 17:28:03 2008 @@ -1,4 +1,4 @@ -<!-- $Revision: 1.219 $ --> +<!-- $Revision: 1.220 $ --> <!-- Keep 'em sorted --> @@ -65,6 +65,12 @@ discourages developers from relying on this directive, and encouragees the use of other means, such as the &link.superglobals;.</para></note>'> +<!ENTITY note.is-superglobal "<note><para>This is a 'superglobal', or +automatic global, variable. This simply means that it is available in +all scopes throughout a script. There is no need to do +<command>global $variable;</command> to access it within functions or methods. +</para></note>"> + <!ENTITY note.superglobals '<note><title>Superglobals: availability note </title><para>Superglobal arrays such as <varname>$_GET</varname>, <varname>$_POST</varname>, and <varname>$_SERVER</varname>, etc. are available http://cvs.php.net/viewvc.cgi/phpdoc/en/appendices/reserved.xml?r1=1.72&r2=1.73&diff_format=u Index: phpdoc/en/appendices/reserved.xml diff -u phpdoc/en/appendices/reserved.xml:1.72 phpdoc/en/appendices/reserved.xml:1.73 --- phpdoc/en/appendices/reserved.xml:1.72 Tue Feb 19 21:45:29 2008 +++ phpdoc/en/appendices/reserved.xml Mon Apr 14 17:28:03 2008 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.72 $ --> +<!-- $Revision: 1.73 $ --> <appendix xml:id="reserved" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"> <title>List of Reserved Words</title> @@ -284,861 +284,6 @@ </table> </sect1> - <sect1 xml:id="reserved.variables"> - <title>Predefined Variables</title> - - <para> - Since PHP 4.1.0, the preferred method for retrieving - <link linkend="language.variables.external">external variables</link> is - with the superglobals mentioned below. Before this time, people relied - on either <link linkend="ini.register-globals">register_globals</link> - or the long predefined PHP arrays (<varname>$HTTP_*_VARS</varname>). - - &avail.register-long-arrays; - </para> - - <sect2 xml:id="reserved.variables.server"> - <title>Server variables: <varname>$_SERVER</varname></title> - <note> - <simpara> - Introduced in 4.1.0. In earlier versions, use - <varname>$HTTP_SERVER_VARS</varname>. - </simpara> - </note> - - <simpara> - <varname>$_SERVER</varname> 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 <link - xlink:href="&url.cgispec;">CGI 1.1 specification</link>, so you should - be able to expect those. - </simpara> - - <simpara> - This is a 'superglobal', or automatic global, variable. This - simply means that it is available in all scopes throughout a - script. You don't need to do a <command>global - $_SERVER;</command> to access it within functions or methods, as - you do with <varname>$HTTP_SERVER_VARS</varname>. - </simpara> - - <simpara> - <varname>$HTTP_SERVER_VARS</varname> contains the same initial - information, but is not a superglobal. (Note that - <varname>$HTTP_SERVER_VARS</varname> and <varname>$_SERVER</varname> - are different variables and that PHP handles them as such) - </simpara> - - <simpara> - If the <link - linkend="ini.register-globals">register_globals</link> directive - is set, then these variables will also be made available in the - global scope of the script; i.e., separate from the - <varname>$_SERVER</varname> and <varname>$HTTP_SERVER_VARS</varname> - arrays. For related information, see the security chapter titled - <link linkend="security.globals">Using Register - Globals</link>. These individual globals are not superglobals. - </simpara> - - <simpara> - You may or may not find any of the following elements in - $_SERVER. Note that few, if any, of these will be available (or - indeed have any meaning) if running PHP on the command line. - </simpara> - - <para> - <variablelist> - <varlistentry> - <term>'<varname>PHP_SELF</varname>'</term> - <listitem> - <simpara> - The filename of the currently executing script, relative to - the document root. For instance, - <varname>$_SERVER['PHP_SELF']</varname> in a script at the - address <filename>http://example.com/test.php/foo.bar</filename> - would be <filename>/test.php/foo.bar</filename>. - The <link linkend="language.constants.predefined">__FILE__</link> - constant contains the full path and filename of the current (i.e. - included) file. - </simpara> - <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. - </simpara> - </listitem> - </varlistentry> - - <varlistentry> - <term>'<varname>argv</varname>'</term> - <listitem> - <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. - </simpara> - </listitem> - </varlistentry> - - <varlistentry> - <term>'<varname>argc</varname>'</term> - <listitem> - <simpara> - Contains the number of command line parameters passed to the - script (if run on the command line). - </simpara> - </listitem> - </varlistentry> - - <varlistentry> - <term>'<varname>GATEWAY_INTERFACE</varname>'</term> - <listitem> - <simpara> - What revision of the CGI specification the server is using; - i.e. '<literal>CGI/1.1</literal>'. - </simpara> - </listitem> - </varlistentry> - - <varlistentry> - <term>'<varname>SERVER_ADDR</varname>'</term> - <listitem> - <simpara> - The IP address of the server under which the current script is - executing. - </simpara> - </listitem> - </varlistentry> - - <varlistentry> - <term>'<varname>SERVER_NAME</varname>'</term> - <listitem> - <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. - </simpara> - </listitem> - </varlistentry> - - <varlistentry> - <term>'<varname>SERVER_SOFTWARE</varname>'</term> - <listitem> - <simpara> - Server identification string, given in the headers when - responding to requests. - </simpara> - </listitem> - </varlistentry> - - <varlistentry> - <term>'<varname>SERVER_PROTOCOL</varname>'</term> - <listitem> - <simpara> - Name and revision of the information protocol via which the - page was requested; i.e. '<literal>HTTP/1.0</literal>'; - </simpara> - </listitem> - </varlistentry> - - <varlistentry> - <term>'<varname>REQUEST_METHOD</varname>'</term> - <listitem> - <simpara> - Which request method was used to access the page; i.e. '<literal>GET</literal>', - '<literal>HEAD</literal>', '<literal>POST</literal>', '<literal>PUT</literal>'. - </simpara> - <note> - <para> - PHP script is terminated after sending headers (it means after - producing any output without output buffering) if the request method - was <literal>HEAD</literal>. - </para> - </note> - </listitem> - </varlistentry> - - <varlistentry> - <term>'<varname>REQUEST_TIME</varname>'</term> - <listitem> - <simpara> - The timestamp of the start of the request. Available since PHP 5.1.0. - </simpara> - </listitem> - </varlistentry> - - <varlistentry> - <term>'<varname>QUERY_STRING</varname>'</term> - <listitem> - <simpara> - The query string, if any, via which the page was accessed. - </simpara> - </listitem> - </varlistentry> - - <varlistentry> - <term>'<varname>DOCUMENT_ROOT</varname>'</term> - <listitem> - <simpara> - The document root directory under which the current script is - executing, as defined in the server's configuration file. - </simpara> - </listitem> - </varlistentry> - - <varlistentry> - <term>'<varname>HTTP_ACCEPT</varname>'</term> - <listitem> - <simpara> - Contents of the <literal>Accept:</literal> header from the - current request, if there is one. - </simpara> - </listitem> - </varlistentry> - - <varlistentry> - <term>'<varname>HTTP_ACCEPT_CHARSET</varname>'</term> - <listitem> - <simpara> - Contents of the <literal>Accept-Charset:</literal> header - from the current request, if there is one. Example: - '<literal>iso-8859-1,*,utf-8</literal>'. - </simpara> - </listitem> - </varlistentry> - - <varlistentry> - <term>'<varname>HTTP_ACCEPT_ENCODING</varname>'</term> - <listitem> - <simpara> - Contents of the <literal>Accept-Encoding:</literal> header - from the current request, if there is one. Example: '<literal>gzip</literal>'. - </simpara> - </listitem> - </varlistentry> - - <varlistentry> - <term>'<varname>HTTP_ACCEPT_LANGUAGE</varname>'</term> - <listitem> - <simpara> - Contents of the <literal>Accept-Language:</literal> header - from the current request, if there is one. Example: '<literal>en</literal>'. - </simpara> - </listitem> - </varlistentry> - - <varlistentry> - <term>'<varname>HTTP_CONNECTION</varname>'</term> - <listitem> - <simpara> - Contents of the <literal>Connection:</literal> header from - the current request, if there is one. Example: '<literal>Keep-Alive</literal>'. - </simpara> - </listitem> - </varlistentry> - - <varlistentry> - <term>'<varname>HTTP_HOST</varname>'</term> - <listitem> - <simpara> - Contents of the <literal>Host:</literal> header from the - current request, if there is one. - </simpara> - </listitem> - </varlistentry> - - <varlistentry> - <term>'<varname>HTTP_REFERER</varname>'</term> - <listitem> - <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 <varname>HTTP_REFERER</varname> as a feature. In - short, it cannot really be trusted. - </simpara> - </listitem> - </varlistentry> - - <varlistentry> - <term>'<varname>HTTP_USER_AGENT</varname>'</term> - <listitem> - <simpara> - Contents of the <literal>User-Agent:</literal> 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: <computeroutput>Mozilla/4.5 [en] (X11; U; - Linux 2.2.9 i586)</computeroutput>. Among other things, you - can use this value with <function>get_browser</function> to - tailor your page's output to the capabilities of the user - agent. - </simpara> - </listitem> - </varlistentry> - - <varlistentry> - <term>'<varname>HTTPS</varname>'</term> - <listitem> - <simpara> - Set to a non-empty value if the script was queried through the HTTPS - protocol. - </simpara> - <simpara> - Note that when using ISAPI with IIS, the value will be - <literal>off</literal> if the request was not made through the HTTPS - protocol. - </simpara> - </listitem> - </varlistentry> - - <varlistentry> - <term>'<varname>REMOTE_ADDR</varname>'</term> - <listitem> - <simpara> - The IP address from which the user is viewing the current - page. - </simpara> - </listitem> - </varlistentry> - - <varlistentry> - <term>'<varname>REMOTE_HOST</varname>'</term> - <listitem> - <simpara> - The Host name from which the user is viewing the current - page. The reverse dns lookup is based off the - <varname>REMOTE_ADDR</varname> of the user. - </simpara> - <note> - <simpara> - Your web server must be configured to create this variable. For - example in Apache you'll need <literal>HostnameLookups On</literal> - inside &httpd.conf; for it to exist. See also - <function>gethostbyaddr</function>. - </simpara> - </note> - </listitem> - </varlistentry> - - <varlistentry> - <term>'<varname>REMOTE_PORT</varname>'</term> - <listitem> - <simpara> - The port being used on the user's machine to communicate with - the web server. - </simpara> - </listitem> - </varlistentry> - - <varlistentry> - <term>'<varname>SCRIPT_FILENAME</varname>'</term> - <listitem> - <para> - The absolute pathname of the currently executing script. - <note> - <para> - If a script is executed with the CLI, as a relative path, - such as <filename>file.php</filename> or - <filename>../file.php</filename>, - <varname>$_SERVER['SCRIPT_FILENAME']</varname> will - contain the relative path specified by the user. - </para> - </note> - </para> - </listitem> - </varlistentry> - - <varlistentry> - <term>'<varname>SERVER_ADMIN</varname>'</term> - <listitem> - <simpara> - The value given to the SERVER_ADMIN (for Apache) directive in - the web server configuration file. If the script is running - on a virtual host, this will be the value defined for that - virtual host. - </simpara> - </listitem> - </varlistentry> - - <varlistentry> - <term>'<varname>SERVER_PORT</varname>'</term> - <listitem> - <simpara> - The port on the server machine being used by the web server - for communication. For default setups, this will be '<literal>80</literal>'; - using SSL, for instance, will change this to whatever your - defined secure HTTP port is. - </simpara> - </listitem> - </varlistentry> - - <varlistentry> - <term>'<varname>SERVER_SIGNATURE</varname>'</term> - <listitem> - <simpara> - String containing the server version and virtual host name - which are added to server-generated pages, if enabled. - </simpara> - </listitem> - </varlistentry> - - <varlistentry> - <term>'<varname>PATH_TRANSLATED</varname>'</term> - <listitem> - <simpara> - Filesystem- (not document root-) based path to the current - script, after the server has done any virtual-to-real - mapping. - </simpara> - <note> - <simpara> - As of PHP 4.3.2, <envar>PATH_TRANSLATED</envar> is no longer set - implicitly under the Apache 2 <acronym>SAPI</acronym> in contrast - to the situation in Apache 1, where it's set to the same value as - the <envar>SCRIPT_FILENAME</envar> server variable when it's not - populated by Apache. This change was made to comply with the - <acronym>CGI</acronym> specification that - <envar>PATH_TRANSLATED</envar> should only exist if - <envar>PATH_INFO</envar> is defined. - </simpara> - <simpara> - Apache 2 users may use <literal>AcceptPathInfo = On</literal> inside - <filename>httpd.conf</filename> to define <envar>PATH_INFO</envar>. - </simpara> - </note> - </listitem> - </varlistentry> - - <varlistentry> - <term>'<varname>SCRIPT_NAME</varname>'</term> - <listitem> - <simpara> - Contains the current script's path. This is useful for pages - which need to point to themselves. - The <link linkend="language.constants.predefined">__FILE__</link> - constant contains the full path and filename of the current (i.e. - included) file. - </simpara> - </listitem> - </varlistentry> - - <varlistentry> - <term>'<varname>REQUEST_URI</varname>'</term> - <listitem> - <simpara> - The URI which was given in order to access this page; for - instance, '<literal>/index.html</literal>'. - </simpara> - </listitem> - </varlistentry> - - <varlistentry> - <term>'<varname>PHP_AUTH_DIGEST</varname>'</term> - <listitem> - <simpara> - When running under Apache as module doing Digest HTTP authentication - this variable is set to the 'Authorization' header sent by the - client (which you should then use to make the appropriate - validation). - </simpara> - </listitem> - </varlistentry> - - <varlistentry> - <term>'<varname>PHP_AUTH_USER</varname>'</term> - <listitem> - <simpara> - When running under Apache or IIS (ISAPI on PHP 5) as module doing - HTTP authentication this variable is set to the username provided by - the user. - </simpara> - </listitem> - </varlistentry> - - <varlistentry> - <term>'<varname>PHP_AUTH_PW</varname>'</term> - <listitem> - <simpara> - When running under Apache or IIS (ISAPI on PHP 5) as module doing - HTTP authentication this variable is set to the password provided by - the user. - </simpara> - </listitem> - </varlistentry> - - <varlistentry> - <term>'<varname>AUTH_TYPE</varname>'</term> - <listitem> - <simpara> - When running under Apache as module doing HTTP authenticated this - variable is set to the authentication type. - </simpara> - </listitem> - </varlistentry> - - </variablelist> - </para> - - </sect2> - - <sect2 xml:id="reserved.variables.environment"> - <title>Environment variables: <varname>$_ENV</varname></title> - - <note> - <simpara> - Introduced in 4.1.0. In earlier versions, use - <varname>$HTTP_ENV_VARS</varname>. - </simpara> - </note> - - <simpara> - These variables are imported into PHP's global namespace from the - environment under which the PHP parser is running. Many are - provided by the shell under which PHP is running and different - systems are likely running different kinds of shells, a - definitive list is impossible. Please see your shell's - documentation for a list of defined environment variables. - </simpara> - - <simpara> - Other environment variables include the CGI variables, placed - there regardless of whether PHP is running as a server module or - CGI processor. - </simpara> - - <simpara> - This is a 'superglobal', or automatic global, variable. This - simply means that it is available in all scopes throughout a - script. You don't need to do a <command>global - $_ENV;</command> to access it within functions or methods, as - you do with <varname>$HTTP_ENV_VARS</varname>. - </simpara> - - <simpara> - <varname>$HTTP_ENV_VARS</varname> contains the same initial - information, but is not a superglobal. (Note that - <varname>$HTTP_ENV_VARS</varname> and <varname>$_ENV</varname> - are different variables and that PHP handles them as such) - </simpara> - - <simpara> - If the <link - linkend="ini.register-globals">register_globals</link> directive - is set, then these variables will also be made available in the - global scope of the script; i.e., separate from the - <varname>$_ENV</varname> and <varname>$HTTP_ENV_VARS</varname> - arrays. For related information, see the security chapter titled - <link linkend="security.globals">Using Register - Globals</link>. These individual globals are not superglobals. - </simpara> - </sect2> - - <sect2 xml:id="reserved.variables.cookies"> - <title>HTTP Cookies: <varname>$_COOKIE</varname></title> - - <note> - <simpara> - Introduced in 4.1.0. In earlier versions, use - <varname>$HTTP_COOKIE_VARS</varname>. - </simpara> - </note> - - <simpara> - An associative array of variables passed to the current script - via HTTP cookies. Automatically global in any scope. - </simpara> - - <simpara> - This is a 'superglobal', or automatic global, variable. This - simply means that it is available in all scopes throughout a - script. You don't need to do a <command>global - $_COOKIE;</command> to access it within functions or methods, as - you do with <varname>$HTTP_COOKIE_VARS</varname>. - </simpara> - - <simpara> - <varname>$HTTP_COOKIE_VARS</varname> contains the same initial - information, but is not a superglobal. (Note that - <varname>$HTTP_COOKIE_VARS</varname> and <varname>$_COOKIE</varname> - are different variables and that PHP handles them as such) - </simpara> - - <simpara> - If the <link - linkend="ini.register-globals">register_globals</link> directive - is set, then these variables will also be made available in the - global scope of the script; i.e., separate from the - <varname>$_COOKIE</varname> and <varname>$HTTP_COOKIE_VARS</varname> - arrays. For related information, see the security chapter titled - <link linkend="security.globals">Using Register - Globals</link>. These individual globals are not superglobals. - </simpara> - </sect2> - - <sect2 xml:id="reserved.variables.get"> - <title>HTTP GET variables: <varname>$_GET</varname></title> - - <note> - <simpara> - Introduced in 4.1.0. In earlier versions, use - <varname>$HTTP_GET_VARS</varname>. - </simpara> - </note> - - <simpara> - An associative array of variables passed to the current script - via the HTTP GET method. Automatically global in any scope. - </simpara> - - <simpara> - This is a 'superglobal', or automatic global, variable. This - simply means that it is available in all scopes throughout a - script. You don't need to do a <command>global - $_GET;</command> to access it within functions or methods, as - you do with <varname>$HTTP_GET_VARS</varname>. - </simpara> - - <simpara> - <varname>$HTTP_GET_VARS</varname> contains the same initial - information, but is not a superglobal. (Note that - <varname>$HTTP_GET_VARS</varname> and <varname>$_GET</varname> - are different variables and that PHP handles them as such) - </simpara> - - <simpara> - If the <link - linkend="ini.register-globals">register_globals</link> directive - is set, then these variables will also be made available in the - global scope of the script; i.e., separate from the - <varname>$_GET</varname> and <varname>$HTTP_GET_VARS</varname> - arrays. For related information, see the security chapter titled - <link linkend="security.globals">Using Register - Globals</link>. These individual globals are not superglobals. - </simpara> - </sect2> - - <sect2 xml:id="reserved.variables.post"> - <title>HTTP POST variables: <varname>$_POST</varname></title> - - <note> - <simpara> - Introduced in 4.1.0. In earlier versions, use - <varname>$HTTP_POST_VARS</varname>. - </simpara> - </note> - - <simpara> - An associative array of variables passed to the current script - via the HTTP POST method. Automatically global in any scope. - </simpara> - - <simpara> - This is a 'superglobal', or automatic global, variable. This - simply means that it is available in all scopes throughout a - script. You don't need to do a <command>global - $_POST;</command> to access it within functions or methods, as - you do with <varname>$HTTP_POST_VARS</varname>. - </simpara> - - <simpara> - <varname>$HTTP_POST_VARS</varname> contains the same initial - information, but is not a superglobal. (Note that - <varname>$HTTP_POST_VARS</varname> and <varname>$_POST</varname> - are different variables and that PHP handles them as such) - </simpara> - - <simpara> - If the <link - linkend="ini.register-globals">register_globals</link> directive - is set, then these variables will also be made available in the - global scope of the script; i.e., separate from the - <varname>$_POST</varname> and <varname>$HTTP_POST_VARS</varname> - arrays. For related information, see the security chapter titled - <link linkend="security.globals">Using Register - Globals</link>. These individual globals are not superglobals. - </simpara> - </sect2> - - <sect2 xml:id="reserved.variables.files"> - <title>HTTP File upload variables: <varname>$_FILES</varname></title> - - <note> - <simpara> - Introduced in 4.1.0. In earlier versions, use - <varname>$HTTP_POST_FILES</varname>. - </simpara> - </note> - - <simpara> - An associative array of items uploaded to the current script - via the HTTP POST method. Automatically global in any scope. - </simpara> - - <simpara> - This is a 'superglobal', or automatic global, variable. This - simply means that it is available in all scopes throughout a - script. You don't need to do a <command>global - $_FILES;</command> to access it within functions or methods, as - you do with <varname>$HTTP_POST_FILES</varname>. - </simpara> - - <simpara> - <varname>$HTTP_POST_FILES</varname> contains the same - information, but is not a superglobal. (Note that - <varname>$HTTP_POST_FILES</varname> and <varname>$_FILES</varname> - are different variables and that PHP handles them as such) - </simpara> - - <simpara> - If the <link - linkend="ini.register-globals">register_globals</link> directive - is set, then these variables will also be made available in the - global scope of the script; i.e., separate from the - <varname>$_FILES</varname> and <varname>$HTTP_POST_FILES</varname> - arrays. For related information, see the security chapter titled - <link linkend="security.globals">Using Register - Globals</link>. These individual globals are not superglobals. - </simpara> - </sect2> - - <sect2 xml:id="reserved.variables.request"> - <title>Request variables: <varname>$_REQUEST</varname></title> - - <note> - <simpara> - Introduced in 4.1.0. There is no equivalent array in earlier - versions. - </simpara> - </note> - <note> - <simpara> - Prior to PHP 4.3.0, <varname>$_FILES</varname> information was - also included in <varname>$_REQUEST</varname>. - </simpara> - </note> - - <simpara> - An associative array consisting of the contents of - <varname>$_GET</varname>, <varname>$_POST</varname>, - and <varname>$_COOKIE</varname>. - </simpara> - - <simpara> - This is a 'superglobal', or automatic global, variable. This - simply means that it is available in all scopes throughout a - script. You don't need to do a <command>global - $_REQUEST;</command> to access it within functions or methods. - </simpara> - - <simpara> - If the <link - linkend="ini.register-globals">register_globals</link> directive - is set, then these variables will also be made available in the - global scope of the script; i.e., separate from the - <varname>$_REQUEST</varname> array. For related information, see - the security chapter titled <link - linkend="security.globals">Using Register - Globals</link>. These individual globals are not superglobals. - </simpara> - </sect2> - - <sect2 xml:id="reserved.variables.session"> - <title>Session variables: <varname>$_SESSION</varname></title> - - <note> - <simpara> - Introduced in 4.1.0. In earlier versions, use - <varname>$HTTP_SESSION_VARS</varname>. - </simpara> - </note> - - <simpara> - An associative array containing session variables available to - the current script. See the <link linkend="ref.session">Session - functions</link> documentation for more information on how this - is used. - </simpara> - - <simpara> - This is a 'superglobal', or automatic global, variable. This - simply means that it is available in all scopes throughout a - script. You don't need to do a <command>global - $_SESSION;</command> to access it within functions or methods, as - you do with <varname>$HTTP_SESSION_VARS</varname>. - </simpara> - - <simpara> - <varname>$HTTP_SESSION_VARS</varname> contains the same - information, but is not a superglobal. (Note that - <varname>$HTTP_SESSION_VARS</varname> and <varname>$_SESSION</varname> - are different variables and that PHP handles them as such) - </simpara> - - <simpara> - If the <link - linkend="ini.register-globals">register_globals</link> directive - is set, then these variables will also be made available in the - global scope of the script; i.e., separate from the - <varname>$_SESSION</varname> and <varname>$HTTP_SESSION_VARS</varname> - arrays. For related information, see the security chapter titled - <link linkend="security.globals">Using Register - Globals</link>. These individual globals are not superglobals. - </simpara> - </sect2> - - <sect2 xml:id="reserved.variables.globals"> - <title>Global variables: <varname>$GLOBALS</varname></title> - - <simpara> - An associative array containing references to all variables which - are currently defined in the global scope of the script. The - variable names are the keys of the array. - </simpara> - - <simpara> - This is a 'superglobal', or automatic global, variable. This - simply means that it is available in all scopes throughout a - script. You don't need to do a <command>global - $GLOBALS;</command> to access it within functions or methods. - </simpara> - - </sect2> - - <sect2 xml:id="reserved.variables.phperrormsg"> - <title>The previous error message: <varname>$php_errormsg</varname></title> - <simpara> - <varname>$php_errormsg</varname> is a variable containing the - text of the last error message generated by PHP. This variable - will only be available within the scope in which the error - occurred, and only if the <link - linkend="ini.track-errors">track_errors</link> configuration - option is turned on (it defaults to off). - </simpara> - </sect2> - - <sect2 xml:id="reserved.variables.httprawpostdata"> - <title>Raw POST data: <varname>$HTTP_RAW_POST_DATA</varname></title> - <para> - <varname>$HTTP_RAW_POST_DATA</varname> contains the raw POST data. - See <link linkend="ini.always-populate-raw-post-data">always_populate_raw_post_data</link> - </para> - </sect2> - - <sect2 xml:id="reserved.variables.httpresponseheader"> - <title>HTTP response headers: <varname>$http_response_header</varname></title> - <para> - The <varname>$http_response_header</varname> array is similiar to the - <function>get_headers</function> function. When using the - <link linkend="wrappers.http">HTTP wrapper</link> - <varname>$http_response_header</varname> will be populated with the HTTP - response headers. - </para> - </sect2> - - </sect1> <sect1 xml:id="reserved.classes"> <title>Predefined Classes</title> <para> http://cvs.php.net/viewvc.cgi/phpdoc/en/language/variables.xml?r1=1.99&r2=1.100&diff_format=u Index: phpdoc/en/language/variables.xml diff -u phpdoc/en/language/variables.xml:1.99 phpdoc/en/language/variables.xml:1.100 --- phpdoc/en/language/variables.xml:1.99 Tue Feb 19 21:45:29 2008 +++ phpdoc/en/language/variables.xml Mon Apr 14 17:28:03 2008 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.99 $ --> +<!-- $Revision: 1.100 $ --> <chapter xml:id="language.variables" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"> <title>Variables</title> @@ -233,126 +233,6 @@ linkend="ini.variables-order">variables_order</link> are not set, their appropriate PHP predefined arrays are also left empty. </para> - - <variablelist xml:id="language.variables.superglobals"> - <title>PHP Superglobals</title> - <varlistentry> - <term><link linkend="reserved.variables.globals">$GLOBALS</link></term> - <listitem> - <simpara> - Contains a reference to every variable which is currently - available within the global scope of the script. The keys of - this array are the names of the global variables. - </simpara> - </listitem> - </varlistentry> - <varlistentry> - <term><link linkend="reserved.variables.server">$_SERVER</link></term> - <listitem> - <simpara> - Variables set by the web server or otherwise directly related - to the execution environment of the current script. Analogous - to the old <varname>$HTTP_SERVER_VARS</varname> array (which is - still available, but deprecated). - </simpara> - </listitem> - </varlistentry> - <varlistentry> - <term><link linkend="reserved.variables.get">$_GET</link></term> - <listitem> - <simpara> - Variables provided to the script via URL query string. Analogous to the - old <varname>$HTTP_GET_VARS</varname> array (which is still - available, but deprecated). - </simpara> - </listitem> - </varlistentry> - <varlistentry> - <term><link linkend="reserved.variables.post">$_POST</link></term> - <listitem> - <simpara> - Variables provided to the script via HTTP POST. Analogous to the - old <varname>$HTTP_POST_VARS</varname> array (which is still - available, but deprecated). - </simpara> - </listitem> - </varlistentry> - <varlistentry> - <term><link linkend="reserved.variables.cookies">$_COOKIE</link></term> - <listitem> - <simpara> - Variables provided to the script via HTTP cookies. Analogous to - the old <varname>$HTTP_COOKIE_VARS</varname> array (which is - still available, but deprecated). - </simpara> - </listitem> - </varlistentry> - <varlistentry> - <term><link linkend="reserved.variables.files">$_FILES</link></term> - <listitem> - <simpara> - Variables provided to the script via HTTP post file - uploads. Analogous to the old - <varname>$HTTP_POST_FILES</varname> array (which is still - available, but deprecated). See <link - linkend="features.file-upload.post-method">POST method - uploads</link> for more information. - </simpara> - </listitem> - </varlistentry> - <varlistentry> - <term><link linkend="reserved.variables.environment">$_ENV</link></term> - <listitem> - <simpara> - Variables provided to the script via the environment. Analogous - to the old <varname>$HTTP_ENV_VARS</varname> array (which is - still available, but deprecated). - </simpara> - </listitem> - </varlistentry> - <varlistentry> - <term><link linkend="reserved.variables.request">$_REQUEST</link></term> - <listitem> - <simpara> - Variables provided to the script via the GET, POST, and COOKIE input - mechanisms, and which therefore cannot be trusted. The presence and - order of variable inclusion in this array is defined according to the - PHP <link linkend="ini.variables-order">variables_order</link> - configuration directive. This array has no direct analogue in versions - of PHP prior to 4.1.0. See also - <function>import_request_variables</function>. - </simpara> - <caution> - <simpara> - Since PHP 4.3.0, FILE information from <varname>$_FILES</varname> does - not exist in <varname>$_REQUEST</varname>. - </simpara> - </caution> - <note> - <simpara> - When running on the <link linkend="features.commandline">command line - </link>, this will <emphasis>not</emphasis> include the - <varname>argv</varname> and <varname>argc</varname> entries; these are - present in the <varname>$_SERVER</varname> array. - </simpara> - </note> - </listitem> - </varlistentry> - <varlistentry> - <term><link linkend="reserved.variables.session">$_SESSION</link></term> - <listitem> - <simpara> - Variables which are currently registered to a script's - session. Analogous to the old - <varname>$HTTP_SESSION_VARS</varname> array (which is still - available, but deprecated). See the <link - linkend="ref.session">Session handling functions</link> section - for more information. - </simpara> - </listitem> - </varlistentry> - </variablelist> - </sect1> http://cvs.php.net/viewvc.cgi/phpdoc/en/language/predefined/variables.xml?view=markup&rev=1.1 Index: phpdoc/en/language/predefined/variables.xml +++ phpdoc/en/language/predefined/variables.xml <?xml version="1.0" encoding="utf-8"?> <!-- $Revision: 1.1 $ --> <reference xml:id="reserved.variables" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"> <title>Predefined variables</title> <partintro> <para> PHP provides a large number of predefined variables to any script. The variables represent everything from <link linkend="language.variables.external">external variables</link> to built-in enviroment variables, last error messages to last retrieved headers. </para> <section xml:id="language.variables.superglobals"> <title>Superglobals</title> <para> Superglobals are built-in variables that are always available in all scopes. These variables are: <simplelist> <member><varname>$GLOBALS</varname></member> <member><varname>$_SERVER</varname></member> <member><varname>$_GET</varname></member> <member><varname>$_POST</varname></member> <member><varname>$_FILES</varname></member> <member><varname>$_COOKIE</varname></member> <member><varname>$_SESSION</varname></member> <member><varname>$_REQUEST</varname></member> <member><varname>$_ENV</varname></member> </simplelist> </para> <note> <simpara> Superglobals cannot be used as <link linkend="language.variables.variable">variable variables</link> inside functions or class methods. </simpara> </note> </section> </partintro> &language.predefined.variables.globals; &language.predefined.variables.server; &language.predefined.variables.get; &language.predefined.variables.post; &language.predefined.variables.files; &language.predefined.variables.request; &language.predefined.variables.session; &language.predefined.variables.env; &language.predefined.variables.cookie; &language.predefined.variables.phperrormsg; &language.predefined.variables.httprawpostdata; &language.predefined.variables.httpresponseheader; &language.predefined.variables.argc; &language.predefined.variables.argv; </reference> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t indent-tabs-mode:nil sgml-parent-document:nil sgml-default-dtd-file:"../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> http://cvs.php.net/viewvc.cgi/phpdoc/en/language/predefined/variables/argc.xml?view=markup&rev=1.1 Index: phpdoc/en/language/predefined/variables/argc.xml +++ phpdoc/en/language/predefined/variables/argc.xml <?xml version="1.0" encoding="utf-8"?> <!-- $Revision: 1.1 $ --> <refentry xml:id="reserved.variables.argc" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"> <refnamediv> <refname>$argc</refname> <refpurpose>The number of arguments passed to script</refpurpose> </refnamediv> <refsect1 role="description"> &reftitle.description; <para> Contains the number of arguments passed to the current script when running from the command line. </para> <note> <simpara> The script's filename is always passed as an argument to the script </simpara> </note> <note> <simpara> This variable is only available when <literal>register_argc_argv</literal> is enabled in <filename>php.ini</filename>. </simpara> </note> </refsect1> <refsect1 role="examples"> &reftitle.examples; <para> <example xml:id="variable.argc.basic"> <title><varname>$argc</varname> example</title> <programlisting role="php"> <![CDATA[ <?php var_dump($argc); ?> ]]> </programlisting> <simpara> When executing the example with: php script.php arg1 arg2 arg3 </simpara> &example.outputs.similar; <screen> <![CDATA[ int(4) ]]> </screen> </example> </para> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t indent-tabs-mode:nil sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> http://cvs.php.net/viewvc.cgi/phpdoc/en/language/predefined/variables/argv.xml?view=markup&rev=1.1 Index: phpdoc/en/language/predefined/variables/argv.xml +++ phpdoc/en/language/predefined/variables/argv.xml <?xml version="1.0" encoding="utf-8"?> <!-- $Revision: 1.1 $ --> <refentry xml:id="reserved.variables.argv" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"> <refnamediv> <refname>$argv</refname> <refpurpose>Array of arguments passed to script</refpurpose> </refnamediv> <refsect1 role="description"> &reftitle.description; <para> Contains an array of all the arguments passed to the script when running from the command line. </para> <note> <simpara> The first argument is always the current script's filename. </simpara> </note> <note> <simpara> This variable is only available when <literal>register_argc_argv</literal> is enabled in <filename>php.ini</filename>. </simpara> </note> </refsect1> <refsect1 role="examples"> &reftitle.examples; <para> <example xml:id="variable.argv.basic"> <title><varname>$argv</varname> example</title> <programlisting role="php"> <![CDATA[ <?php var_dump($argv); ?> ]]> </programlisting> <simpara> When executing the example with: php script.php arg1 arg2 arg3 </simpara> &example.outputs.similar; <screen> <![CDATA[ array(4) { [0]=> string(10) "script.php" [1]=> string(4) "arg1" [2]=> string(4) "arg2" [3]=> string(4) "arg3" } ]]> </screen> </example> </para> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t indent-tabs-mode:nil sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> http://cvs.php.net/viewvc.cgi/phpdoc/en/language/predefined/variables/cookie.xml?view=markup&rev=1.1 Index: phpdoc/en/language/predefined/variables/cookie.xml +++ phpdoc/en/language/predefined/variables/cookie.xml <?xml version="1.0" encoding="utf-8"?> <!-- $Revision: 1.1 $ --> <refentry xml:id="reserved.variables.cookies" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"> <refnamediv> <refname>$_COOKIE</refname> <refname>$HTTP_COOKIE_VARS</refname> <refpurpose>HTTP Cookies</refpurpose> </refnamediv> <refsect1 role="description"> &reftitle.description; <para> An associative array of variables passed to the current script via HTTP Cookies. </para> <simpara> <varname>$HTTP_COOKIE_VARS</varname> contains the same initial information, but is not a superglobal. (Note that <varname>$HTTP_COOKIE_VARS</varname> and <varname>$_COOKIE</varname> are different variables and that PHP handles them as such) </simpara> <simpara> If the <link linkend="ini.register-globals">register_globals</link> directive is set, then these variables will also be made available in the global scope of the script; i.e., separate from the <varname>$_COOKIE</varname> and <varname>$HTTP_COOKIE_VARS</varname> arrays. For related information, see the security chapter titled <link linkend="security.globals">Using Register Globals</link>. These individual globals are not superglobals. </simpara> </refsect1> <refsect1 role="changelog"> &reftitle.changelog; <para> <informaltable> <tgroup cols="2"> <thead> <row> <entry>&Version;</entry> <entry>&Description;</entry> </row> </thead> <tbody> <row> <entry>4.1.0</entry> <entry> Introduced <varname>$_COOKIE</varname>. In previous the <varname>$HTTP_COOKIE_VARS</varname> contained these information. </entry> </row> </tbody> </tgroup> </informaltable> </para> </refsect1> <refsect1 role="examples"> &reftitle.examples; <para> <example xml:id="variable.cookie.basic"> <title><varname>$_COOKIE</varname> example</title> <programlisting role="php"> <![CDATA[ <?php echo 'Hello ' . htmlspecialchars($_COOKIE["name"]) . '!'; ?> ]]> </programlisting> <simpara> Assuming the "name" cookie has been set earlier </simpara> &example.outputs.similar; <screen> <![CDATA[ Hello Hannes! ]]> </screen> </example> </para> </refsect1> <refsect1 role="notes"> &reftitle.notes; ¬e.is-superglobal; </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t indent-tabs-mode:nil sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> http://cvs.php.net/viewvc.cgi/phpdoc/en/language/predefined/variables/env.xml?view=markup&rev=1.1 Index: phpdoc/en/language/predefined/variables/env.xml +++ phpdoc/en/language/predefined/variables/env.xml <?xml version="1.0" encoding="utf-8"?> <!-- $Revision: 1.1 $ --> <refentry xml:id="reserved.variables.environment" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"> <refnamediv> <refname>$_ENV</refname> <refname>$HTTP_ENV_VARS</refname> <refpurpose>Environment variables</refpurpose> </refnamediv> <refsect1 role="description"> &reftitle.description; <para> An associative array of variables passed to the current script via the environment method. </para> <simpara> These variables are imported into PHP's global namespace from the environment under which the PHP parser is running. Many are provided by the shell under which PHP is running and different systems are likely running different kinds of shells, a definitive list is impossible. Please see your shell's documentation for a list of defined environment variables. </simpara> <simpara> Other environment variables include the CGI variables, placed there regardless of whether PHP is running as a server module or CGI processor. </simpara> <simpara> <varname>$HTTP_ENV_VARS</varname> contains the same initial information, but is not a superglobal. (Note that <varname>$HTTP_ENV_VARS</varname> and <varname>$_ENV</varname> are different variables and that PHP handles them as such) </simpara> <simpara> If the <link linkend="ini.register-globals">register_globals</link> directive is set, then these variables will also be made available in the global scope of the script; i.e., separate from the <varname>$_ENV</varname> and <varname>$HTTP_ENV_VARS</varname> arrays. For related information, see the security chapter titled <link linkend="security.globals">Using Register Globals</link>. These individual globals are not superglobals. </simpara> </refsect1> <refsect1 role="changelog"> &reftitle.changelog; <para> <informaltable> <tgroup cols="2"> <thead> <row> <entry>&Version;</entry> <entry>&Description;</entry> </row> </thead> <tbody> <row> <entry>4.1.0</entry> <entry> Introduced <varname>$_ENV</varname>. In previous the <varname>$HTTP_ENV_VARS</varname> contained these information. </entry> </row> </tbody> </tgroup> </informaltable> </para> </refsect1> <refsect1 role="examples"> &reftitle.examples; <para> <example xml:id="variable.env.basic"> <title><varname>$_ENV</varname> example</title> <programlisting role="php"> <![CDATA[ <?php echo 'My username is ' .$_ENV["user"] . '!'; ?> ]]> </programlisting> <simpara> Assuming "bjori" executes this script </simpara> &example.outputs.similar; <screen> <![CDATA[ My username is bjori! ]]> </screen> </example> </para> </refsect1> <refsect1 role="notes"> &reftitle.notes; ¬e.is-superglobal; </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t indent-tabs-mode:nil sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> http://cvs.php.net/viewvc.cgi/phpdoc/en/language/predefined/variables/files.xml?view=markup&rev=1.1 Index: phpdoc/en/language/predefined/variables/files.xml +++ phpdoc/en/language/predefined/variables/files.xml <?xml version="1.0" encoding="utf-8"?> <!-- $Revision: 1.1 $ --> <refentry xml:id="reserved.variables.files" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"> <refnamediv> <refname>$_FILES</refname> <refname>$HTTP_POST_FILES</refname> <refpurpose>HTTP File Upload variables</refpurpose> </refnamediv> <refsect1 role="description"> &reftitle.description; <para> An associative array of items uploaded to the current script via the HTTP POST method. </para> <simpara> <varname>$HTTP_POST_FILES</varname> contains the same initial information, but is not a superglobal. (Note that <varname>$HTTP_POST_FILES</varname> and <varname>$_FILES</varname> are different variables and that PHP handles them as such) </simpara> <simpara> If the <link linkend="ini.register-globals">register_globals</link> directive is set, then these variables will also be made available in the global scope of the script; i.e., separate from the <varname>$_FILES</varname> and <varname>$HTTP_POST_FILES</varname> arrays. For related information, see the security chapter titled <link linkend="security.globals">Using Register Globals</link>. These individual globals are not superglobals. </simpara> </refsect1> <refsect1 role="changelog"> &reftitle.changelog; <para> <informaltable> <tgroup cols="2"> <thead> <row> <entry>&Version;</entry> <entry>&Description;</entry> </row> </thead> <tbody> <row> <entry>4.1.0</entry> <entry> Introduced <varname>$_FILES</varname>. In previous the <varname>$HTTP_POST_FILES</varname> contained these information. </entry> </row> </tbody> </tgroup> </informaltable> </para> </refsect1> <refsect1 role="notes"> &reftitle.notes; ¬e.is-superglobal; </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t indent-tabs-mode:nil sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> http://cvs.php.net/viewvc.cgi/phpdoc/en/language/predefined/variables/get.xml?view=markup&rev=1.1 Index: phpdoc/en/language/predefined/variables/get.xml +++ phpdoc/en/language/predefined/variables/get.xml <?xml version="1.0" encoding="utf-8"?> <!-- $Revision: 1.1 $ --> <refentry xml:id="reserved.variables.get" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"> <refnamediv> <refname>$_GET</refname> <refname>$HTTP_GET_VARS</refname> <refpurpose>HTTP GET variables</refpurpose> </refnamediv> <refsect1 role="description"> &reftitle.description; <para> An associative array of variables passed to the current script via the HTTP GET method. </para> <simpara> <varname>$HTTP_GET_VARS</varname> contains the same initial information, but is not a superglobal. (Note that <varname>$HTTP_GET_VARS</varname> and <varname>$_GET</varname> are different variables and that PHP handles them as such) </simpara> <simpara> If the <link linkend="ini.register-globals">register_globals</link> directive is set, then these variables will also be made available in the global scope of the script; i.e., separate from the <varname>$_GET</varname> and <varname>$HTTP_GET_VARS</varname> arrays. For related information, see the security chapter titled <link linkend="security.globals">Using Register Globals</link>. These individual globals are not superglobals. </simpara> </refsect1> <refsect1 role="changelog"> &reftitle.changelog; <para> <informaltable> <tgroup cols="2"> <thead> <row> <entry>&Version;</entry> <entry>&Description;</entry> </row> </thead> <tbody> <row> <entry>4.1.0</entry> <entry> Introduced <varname>$_GET</varname>. In previous the <varname>$HTTP_GET_VARS</varname> contained these information. </entry> </row> </tbody> </tgroup> </informaltable> </para> </refsect1> <refsect1 role="examples"> &reftitle.examples; <para> <example xml:id="variable.get.basic"> <title><varname>$_GET</varname> example</title> <programlisting role="php"> <![CDATA[ <?php echo 'Hello ' . htmlspecialchars($_GET["name"]) . '!'; ?> ]]> </programlisting> <simpara> Assuming the user entered http://example.com/?name=Hannes </simpara> &example.outputs.similar; <screen> <![CDATA[ Hello Hannes! ]]> </screen> </example> </para> </refsect1> <refsect1 role="notes"> &reftitle.notes; ¬e.is-superglobal; </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t indent-tabs-mode:nil sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> http://cvs.php.net/viewvc.cgi/phpdoc/en/language/predefined/variables/globals.xml?view=markup&rev=1.1 Index: phpdoc/en/language/predefined/variables/globals.xml +++ phpdoc/en/language/predefined/variables/globals.xml <?xml version="1.0" encoding="utf-8"?> <!-- $Revision: 1.1 $ --> <refentry xml:id="variable.globals" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"> <refnamediv> <refname>$GLOBALS</refname> <refpurpose>References all variables available in global scope</refpurpose> </refnamediv> <refsect1 role="description"> &reftitle.description; <para> An associative array containing references to all variables which are currently defined in the global scope of the script. The variable names are the keys of the array. </para> </refsect1> <refsect1 role="examples"> &reftitle.examples; <para> <example xml:id="variable.globals.basic"> <title><varname>$GLOBALS</varname> example</title> <programlisting role="php"> <![CDATA[ <?php function test() { $foo = "local variable"; echo '$foo in global scope: ' . $GLOBALS["foo"] . "\n"; echo '$foo in current scope: ' . $foo . "\n"; } $foo = "Example content"; test(); ?> ]]> </programlisting> &example.outputs.similar; <screen> <![CDATA[ $foo in global scope: Example content $foo in current scope: local variable ]]> </screen> </example> </para> </refsect1> <refsect1 role="notes"> &reftitle.notes; ¬e.is-superglobal; </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t indent-tabs-mode:nil sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> http://cvs.php.net/viewvc.cgi/phpdoc/en/language/predefined/variables/httprawpostdata.xml?view=markup&rev=1.1 Index: phpdoc/en/language/predefined/variables/httprawpostdata.xml +++ phpdoc/en/language/predefined/variables/httprawpostdata.xml <?xml version="1.0" encoding="utf-8"?> <!-- $Revision: 1.1 $ --> <refentry xml:id="reserved.variables.httprawpostdata" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"> <refnamediv> <refname>$HTTP_RAW_POST_DATA</refname> <refpurpose>Raw POST data</refpurpose> </refnamediv> <refsect1 role="description"> &reftitle.description; <para> <varname>$HTTP_RAW_POST_DATA</varname> contains the raw POST data. See <link linkend="ini.always-populate-raw-post-data">always_populate_raw_post_data</link> </para> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t indent-tabs-mode:nil sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> http://cvs.php.net/viewvc.cgi/phpdoc/en/language/predefined/variables/httpresponseheader.xml?view=markup&rev=1.1 Index: phpdoc/en/language/predefined/variables/httpresponseheader.xml +++ phpdoc/en/language/predefined/variables/httpresponseheader.xml <?xml version="1.0" encoding="utf-8"?> <!-- $Revision: 1.1 $ --> <refentry xml:id="reserved.variables.httpresponseheader" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"> <refnamediv> <refname>$http_response_header</refname> <refpurpose>HTTP response headers</refpurpose> </refnamediv> <refsect1 role="description"> &reftitle.description; <para> The <varname>$http_response_header</varname> array is similiar to the <function>get_headers</function> function. When using the <link linkend="wrappers.http">HTTP wrapper</link> <varname>$http_response_header</varname> will be populated with the HTTP response headers. </para> </refsect1> <refsect1 role="examples"> &reftitle.examples; <para> <example xml:id="variable.httpresponseheader.basic"> <title><varname>$http_response_header</varname> example</title> <programlisting role="php"> <![CDATA[ <?php file_get_contents("http://example.com"); var_dump($http_response_header); ?> ]]> </programlisting> &example.outputs.similar; <screen> <![CDATA[ array(9) { [0]=> string(15) "HTTP/1.1 200 OK" [1]=> string(35) "Date: Sat, 12 Apr 2008 17:30:38 GMT" [2]=> string(29) "Server: Apache/2.2.3 (CentOS)" [3]=> string(44) "Last-Modified: Tue, 15 Nov 2005 13:24:10 GMT" [4]=> string(27) "ETag: "280100-1b6-80bfd280"" [5]=> string(20) "Accept-Ranges: bytes" [6]=> string(19) "Content-Length: 438" [7]=> string(17) "Connection: close" [8]=> string(38) "Content-Type: text/html; charset=UTF-8" } ]]> </screen> </example> </para> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t indent-tabs-mode:nil sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> http://cvs.php.net/viewvc.cgi/phpdoc/en/language/predefined/variables/phperrormsg.xml?view=markup&rev=1.1 Index: phpdoc/en/language/predefined/variables/phperrormsg.xml +++ phpdoc/en/language/predefined/variables/phperrormsg.xml <?xml version="1.0" encoding="utf-8"?> <!-- $Revision: 1.1 $ --> <refentry xml:id="reserved.variables.phperrormsg" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"> <refnamediv> <refname>$php_errormsg</refname> <refpurpose>The previous error message</refpurpose> </refnamediv> <refsect1 role="description"> &reftitle.description; <para> <varname>$php_errormsg</varname> is a variable containing the text of the last error message generated by PHP. This variable will only be available within the scope in which the error occurred, and only if the <link linkend="ini.track-errors">track_errors</link> configuration option is turned on (it defaults to off). </para> <note> <simpara> This variable is only available when <literal>track_errors</literal> is enabled in <filename>php.ini</filename>. </simpara> </note> <warning> <simpara> If a <link linkend="function.set-error-handler">user defined error handler</link> is set <varname>$php_erromsg</varname> is only set if the error handler returns &false; </simpara> </warning> </refsect1> <refsect1 role="examples"> &reftitle.examples; <para> <example xml:id="variable.phperrormsg.basic"> <title><varname>$php_errormsg</varname> example</title> <programlisting role="php"> <![CDATA[ <?php @strpos(); echo $php_errormsg; ?> ]]> </programlisting> &example.outputs.similar; <screen> <![CDATA[ Wrong parameter count for strpos() ]]> </screen> </example> </para> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t indent-tabs-mode:nil sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> http://cvs.php.net/viewvc.cgi/phpdoc/en/language/predefined/variables/post.xml?view=markup&rev=1.1 Index: phpdoc/en/language/predefined/variables/post.xml +++ phpdoc/en/language/predefined/variables/post.xml <?xml version="1.0" encoding="utf-8"?> <!-- $Revision: 1.1 $ --> <refentry xml:id="reserved.variables.post" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"> <refnamediv> <refname>$_POST</refname> <refname>$HTTP_POST_VARS</refname> <refpurpose>HTTP POST variables</refpurpose> </refnamediv> <refsect1 role="description"> &reftitle.description; <para> An associative array of variables passed to the current script via the HTTP POST method. </para> <simpara> <varname>$HTTP_POST_VARS</varname> contains the same initial information, but is not a superglobal. (Note that <varname>$HTTP_POST_VARS</varname> and <varname>$_POST</varname> are different variables and that PHP handles them as such) </simpara> <simpara> If the <link linkend="ini.register-globals">register_globals</link> directive is set, then these variables will also be made available in the global scope of the script; i.e., separate from the <varname>$_POST</varname> and <varname>$HTTP_POST_VARS</varname> arrays. For related information, see the security chapter titled <link linkend="security.globals">Using Register Globals</link>. These individual globals are not superglobals. </simpara> </refsect1> <refsect1 role="changelog"> &reftitle.changelog; <para> <informaltable> <tgroup cols="2"> <thead> <row> <entry>&Version;</entry> <entry>&Description;</entry> </row> </thead> <tbody> <row> <entry>4.1.0</entry> <entry> Introduced <varname>$_POST</varname>. In previous the <varname>$HTTP_POST_VARS</varname> contained these information. </entry> </row> </tbody> </tgroup> </informaltable> </para> </refsect1> <refsect1 role="examples"> &reftitle.examples; <para> <example xml:id="variable.post.basic"> <title><varname>$_POST</varname> example</title> <programlisting role="php"> <![CDATA[ <?php echo 'Hello ' . htmlspecialchars($_POST["name"]) . '!'; ?> ]]> </programlisting> <simpara> Assuming the user POSTed name=Hannes </simpara> &example.outputs.similar; <screen> <![CDATA[ Hello Hannes! ]]> </screen> </example> </para> </refsect1> <refsect1 role="notes"> &reftitle.notes; ¬e.is-superglobal; </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t indent-tabs-mode:nil sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> http://cvs.php.net/viewvc.cgi/phpdoc/en/language/predefined/variables/request.xml?view=markup&rev=1.1 Index: phpdoc/en/language/predefined/variables/request.xml +++ phpdoc/en/language/predefined/variables/request.xml <?xml version="1.0" encoding="utf-8"?> <!-- $Revision: 1.1 $ --> <refentry xml:id="reserved.variables.request" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"> <refnamediv> <refname>$_REQUEST</refname> <refpurpose>Request variables</refpurpose> </refnamediv> <refsect1 role="description"> &reftitle.description; <para> An associative array consisting of the contents of <varname>$_GET</varname>, <varname>$_POST</varname>, and <varname>$_COOKIE</varname>. </para> <simpara> Variables provided to the script via the GET, POST, and COOKIE input mechanisms, and which therefore cannot be trusted. The presence and order of variable inclusion in this array is defined according to the PHP <link linkend="ini.variables-order">variables_order</link> configuration directive. This array has no direct analogue in versions of PHP prior to 4.1.0. </simpara> <simpara> When running on the <link linkend="features.commandline">command line </link>, this will <emphasis>not</emphasis> include the <varname>argv</varname> and <varname>argc</varname> entries; these are present in the <varname>$_SERVER</varname> array. </simpara> <simpara> If the <link linkend="ini.register-globals">register_globals</link> directive is set, then these variables will also be made available in the global scope of the script; i.e., separate from the <varname>$_REQUEST</varname> array. For related information, see the security chapter titled <link linkend="security.globals">Using Register Globals</link>. These individual globals are not superglobals. </simpara> </refsect1> <refsect1 role="changelog"> &reftitle.changelog; <para> <informaltable> <tgroup cols="2"> <thead> <row> <entry>&Version;</entry> <entry>&Description;</entry> </row> </thead> <tbody> <row> <entry>4.3.0</entry> <entry> <varname>$_FILES</varname> information was removed from <varname>$_REQUEST</varname>. </entry> </row> <row> <entry>4.1.0</entry> <entry> Introduced <varname>$_REQUEST</varname>. </entry> </row> </tbody> </tgroup> </informaltable> </para> </refsect1> <refsect1 role="notes"> &reftitle.notes; ¬e.is-superglobal; </refsect1> <refsect1 role="seealso"> &reftitle.seealso; <simplelist> <member><function>import_request_variables</function></member> </simplelist> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t indent-tabs-mode:nil sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> http://cvs.php.net/viewvc.cgi/phpdoc/en/language/predefined/variables/server.xml?view=markup&rev=1.1 Index: phpdoc/en/language/predefined/variables/server.xml +++ phpdoc/en/language/predefined/variables/server.xml <?xml version="1.0" encoding="utf-8"?> <!-- $Revision: 1.1 $ --> <refentry xml:id="reserved.variables.server" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"> <refnamediv> <refname>$_SERVER</refname> <refname>$HTTP_SERVER_VARS</refname> <refpurpose>Server and execution enviroment information</refpurpose> </refnamediv> <refsect1 role="description"> &reftitle.description; <para> <varname>$_SERVER</varname> 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 <link xlink:href="&url.cgispec;">CGI 1.1 specification</link>, so you should be able to expect those. </para> <simpara> <varname>$HTTP_SERVER_VARS</varname> contains the same initial information, but is not a superglobal. (Note that <varname>$HTTP_SERVER_VARS</varname> and <varname>$_SERVER</varname> are different variables and that PHP handles them as such) </simpara> <simpara> If the <link linkend="ini.register-globals">register_globals</link> directive is set, then these variables will also be made available in the global scope of the script; i.e., separate from the <varname>$_SERVER</varname> and <varname>$HTTP_SERVER_VARS</varname> arrays. For related information, see the security chapter titled <link linkend="security.globals">Using Register Globals</link>. These individual globals are not superglobals. </simpara> <simpara> You may or may not find any of the following elements in $_SERVER. Note that few, if any, of these will be available (or indeed have any meaning) if running PHP on the command line. </simpara> <para> <variablelist> <varlistentry> <term>'<varname>PHP_SELF</varname>'</term> <listitem> <simpara> The filename of the currently executing script, relative to the document root. For instance, <varname>$_SERVER['PHP_SELF']</varname> in a script at the address <filename>http://example.com/test.php/foo.bar</filename> would be <filename>/test.php/foo.bar</filename>. The <link linkend="language.constants.predefined">__FILE__</link> constant contains the full path and filename of the current (i.e. included) file. </simpara> <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. </simpara> </listitem> </varlistentry> <varlistentry> <term>'<varname>argv</varname>'</term> <listitem> <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. </simpara> </listitem> </varlistentry> <varlistentry> <term>'<varname>argc</varname>'</term> <listitem> <simpara> Contains the number of command line parameters passed to the script (if run on the command line). </simpara> </listitem> </varlistentry> <varlistentry> <term>'<varname>GATEWAY_INTERFACE</varname>'</term> <listitem> <simpara> What revision of the CGI specification the server is using; i.e. '<literal>CGI/1.1</literal>'. </simpara> </listitem> </varlistentry> <varlistentry> <term>'<varname>SERVER_ADDR</varname>'</term> <listitem> <simpara> The IP address of the server under which the current script is executing. </simpara> </listitem> </varlistentry> <varlistentry> <term>'<varname>SERVER_NAME</varname>'</term> <listitem> <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. </simpara> </listitem> </varlistentry> <varlistentry> <term>'<varname>SERVER_SOFTWARE</varname>'</term> <listitem> <simpara> Server identification string, given in the headers when responding to requests. </simpara> </listitem> </varlistentry> <varlistentry> <term>'<varname>SERVER_PROTOCOL</varname>'</term> <listitem> <simpara> Name and revision of the information protocol via which the page was requested; i.e. '<literal>HTTP/1.0</literal>'; </simpara> </listitem> </varlistentry> <varlistentry> <term>'<varname>REQUEST_METHOD</varname>'</term> <listitem> <simpara> Which request method was used to access the page; i.e. '<literal>GET</literal>', '<literal>HEAD</literal>', '<literal>POST</literal>', '<literal>PUT</literal>'. </simpara> <note> <para> PHP script is terminated after sending headers (it means after producing any output without output buffering) if the request method was <literal>HEAD</literal>. </para> </note> </listitem> </varlistentry> <varlistentry> <term>'<varname>REQUEST_TIME</varname>'</term> <listitem> <simpara> The timestamp of the start of the request. Available since PHP 5.1.0. </simpara> </listitem> </varlistentry> <varlistentry> <term>'<varname>QUERY_STRING</varname>'</term> <listitem> <simpara> The query string, if any, via which the page was accessed. </simpara> </listitem> </varlistentry> <varlistentry> <term>'<varname>DOCUMENT_ROOT</varname>'</term> <listitem> <simpara> The document root directory under which the current script is executing, as defined in the server's configuration file. </simpara> </listitem> </varlistentry> <varlistentry> <term>'<varname>HTTP_ACCEPT</varname>'</term> <listitem> <simpara> Contents of the <literal>Accept:</literal> header from the current request, if there is one. </simpara> </listitem> </varlistentry> <varlistentry> <term>'<varname>HTTP_ACCEPT_CHARSET</varname>'</term> <listitem> <simpara> Contents of the <literal>Accept-Charset:</literal> header from the current request, if there is one. Example: '<literal>iso-8859-1,*,utf-8</literal>'. </simpara> </listitem> </varlistentry> <varlistentry> <term>'<varname>HTTP_ACCEPT_ENCODING</varname>'</term> <listitem> <simpara> Contents of the <literal>Accept-Encoding:</literal> header from the current request, if there is one. Example: '<literal>gzip</literal>'. </simpara> </listitem> </varlistentry> <varlistentry> <term>'<varname>HTTP_ACCEPT_LANGUAGE</varname>'</term> <listitem> <simpara> Contents of the <literal>Accept-Language:</literal> header from the current request, if there is one. Example: '<literal>en</literal>'. </simpara> </listitem> </varlistentry> <varlistentry> <term>'<varname>HTTP_CONNECTION</varname>'</term> <listitem> <simpara> Contents of the <literal>Connection:</literal> header from the current request, if there is one. Example: '<literal>Keep-Alive</literal>'. </simpara> </listitem> </varlistentry> <varlistentry> <term>'<varname>HTTP_HOST</varname>'</term> <listitem> <simpara> Contents of the <literal>Host:</literal> header from the current request, if there is one. </simpara> </listitem> </varlistentry> <varlistentry> <term>'<varname>HTTP_REFERER</varname>'</term> <listitem> <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 <varname>HTTP_REFERER</varname> as a feature. In short, it cannot really be trusted. </simpara> </listitem> </varlistentry> <varlistentry> <term>'<varname>HTTP_USER_AGENT</varname>'</term> <listitem> <simpara> Contents of the <literal>User-Agent:</literal> 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: <computeroutput>Mozilla/4.5 [en] (X11; U; Linux 2.2.9 i586)</computeroutput>. Among other things, you can use this value with <function>get_browser</function> to tailor your page's output to the capabilities of the user agent. </simpara> </listitem> </varlistentry> <varlistentry> <term>'<varname>HTTPS</varname>'</term> <listitem> <simpara> Set to a non-empty value if the script was queried through the HTTPS protocol. </simpara> <simpara> Note that when using ISAPI with IIS, the value will be <literal>off</literal> if the request was not made through the HTTPS protocol. </simpara> </listitem> </varlistentry> <varlistentry> <term>'<varname>REMOTE_ADDR</varname>'</term> <listitem> <simpara> The IP address from which the user is viewing the current page. </simpara> </listitem> </varlistentry> <varlistentry> <term>'<varname>REMOTE_HOST</varname>'</term> <listitem> <simpara> The Host name from which the user is viewing the current page. The reverse dns lookup is based off the <varname>REMOTE_ADDR</varname> of the user. </simpara> <note> <simpara> Your web server must be configured to create this variable. For example in Apache you'll need <literal>HostnameLookups On</literal> inside &httpd.conf; for it to exist. See also <function>gethostbyaddr</function>. </simpara> </note> </listitem> </varlistentry> <varlistentry> <term>'<varname>REMOTE_PORT</varname>'</term> <listitem> <simpara> The port being used on the user's machine to communicate with the web server. </simpara> </listitem> </varlistentry> <varlistentry> <term>'<varname>SCRIPT_FILENAME</varname>'</term> <listitem> <para> The absolute pathname of the currently executing script. <note> <para> If a script is executed with the CLI, as a relative path, such as <filename>file.php</filename> or <filename>../file.php</filename>, <varname>$_SERVER['SCRIPT_FILENAME']</varname> will contain the relative path specified by the user. </para> </note> </para> </listitem> </varlistentry> <varlistentry> <term>'<varname>SERVER_ADMIN</varname>'</term> <listitem> <simpara> The value given to the SERVER_ADMIN (for Apache) directive in the web server configuration file. If the script is running on a virtual host, this will be the value defined for that virtual host. </simpara> </listitem> </varlistentry> <varlistentry> <term>'<varname>SERVER_PORT</varname>'</term> <listitem> <simpara> The port on the server machine being used by the web server for communication. For default setups, this will be '<literal>80</literal>'; using SSL, for instance, will change this to whatever your defined secure HTTP port is. </simpara> </listitem> </varlistentry> <varlistentry> <term>'<varname>SERVER_SIGNATURE</varname>'</term> <listitem> <simpara> String containing the server version and virtual host name which are added to server-generated pages, if enabled. </simpara> </listitem> </varlistentry> <varlistentry> <term>'<varname>PATH_TRANSLATED</varname>'</term> <listitem> <simpara> Filesystem- (not document root-) based path to the current script, after the server has done any virtual-to-real mapping. </simpara> <note> <simpara> As of PHP 4.3.2, <envar>PATH_TRANSLATED</envar> is no longer set implicitly under the Apache 2 <acronym>SAPI</acronym> in contrast to the situation in Apache 1, where it's set to the same value as the <envar>SCRIPT_FILENAME</envar> server variable when it's not populated by Apache. This change was made to comply with the <acronym>CGI</acronym> specification that <envar>PATH_TRANSLATED</envar> should only exist if <envar>PATH_INFO</envar> is defined. </simpara> <simpara> Apache 2 users may use <literal>AcceptPathInfo = On</literal> inside <filename>httpd.conf</filename> to define <envar>PATH_INFO</envar>. </simpara> </note> </listitem> </varlistentry> <varlistentry> <term>'<varname>SCRIPT_NAME</varname>'</term> <listitem> <simpara> Contains the current script's path. This is useful for pages which need to point to themselves. The <link linkend="language.constants.predefined">__FILE__</link> constant contains the full path and filename of the current (i.e. included) file. </simpara> </listitem> </varlistentry> <varlistentry> <term>'<varname>REQUEST_URI</varname>'</term> <listitem> <simpara> The URI which was given in order to access this page; for instance, '<literal>/index.html</literal>'. </simpara> </listitem> </varlistentry> <varlistentry> <term>'<varname>PHP_AUTH_DIGEST</varname>'</term> <listitem> <simpara> When running under Apache as module doing Digest HTTP authentication this variable is set to the 'Authorization' header sent by the client (which you should then use to make the appropriate validation). </simpara> </listitem> </varlistentry> <varlistentry> <term>'<varname>PHP_AUTH_USER</varname>'</term> <listitem> <simpara> When running under Apache or IIS (ISAPI on PHP 5) as module doing HTTP authentication this variable is set to the username provided by the user. </simpara> </listitem> </varlistentry> <varlistentry> <term>'<varname>PHP_AUTH_PW</varname>'</term> <listitem> <simpara> When running under Apache or IIS (ISAPI on PHP 5) as module doing HTTP authentication this variable is set to the password provided by the user. </simpara> </listitem> </varlistentry> <varlistentry> <term>'<varname>AUTH_TYPE</varname>'</term> <listitem> <simpara> When running under Apache as module doing HTTP authenticated this variable is set to the authentication type. </simpara> </listitem> </varlistentry> </variablelist> </para> </refsect1> <refsect1 role="changelog"> &reftitle.changelog; <para> <informaltable> <tgroup cols="2"> <thead> <row> <entry>&Version;</entry> <entry>&Description;</entry> </row> </thead> <tbody> <row> <entry>4.1.0</entry> <entry> Introduced <varname>$_SERVER</varname>. In previous versions the <varname>$HTTP_SERVER_VARS</varname> contained these information. </entry> </row> </tbody> </tgroup> </informaltable> </para> </refsect1> <refsect1 role="examples"> &reftitle.examples; <para> <example xml:id="variable.server.basic"> <title><varname>$_SERVER</varname> example</title> <programlisting role="php"> <![CDATA[ <?php var_dump($_SERVER["SERVER_NAME"]); ?> ]]> </programlisting> &example.outputs.similar; <screen> <![CDATA[ www.php.net ]]> </screen> </example> </para> </refsect1> <refsect1 role="notes"> &reftitle.notes; ¬e.is-superglobal; </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t indent-tabs-mode:nil sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> http://cvs.php.net/viewvc.cgi/phpdoc/en/language/predefined/variables/session.xml?view=markup&rev=1.1 Index: phpdoc/en/language/predefined/variables/session.xml +++ phpdoc/en/language/predefined/variables/session.xml <?xml version="1.0" encoding="utf-8"?> <!-- $Revision: 1.1 $ --> <refentry xml:id="reserved.variables.session" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"> <refnamediv> <refname>$_SESSION</refname> <refname>$HTTP_SESSION_VARS</refname> <refpurpose>Session variables</refpurpose> </refnamediv> <refsect1 role="description"> &reftitle.description; <para> An associative array containing session variables available to the current script. See the <link linkend="ref.session">Session functions</link> documentation for more information on how this is used. </para> <simpara> <varname>$HTTP_SESSION_VARS</varname> contains the same initial information, but is not a superglobal. (Note that <varname>$HTTP_SESSION_VARS</varname> and <varname>$_SESSION</varname> are different variables and that PHP handles them as such) </simpara> <simpara> If the <link linkend="ini.register-globals">register_globals</link> directive is set, then these variables will also be made available in the global scope of the script; i.e., separate from the <varname>$_SESSION</varname> and <varname>$HTTP_SESSION_VARS</varname> arrays. For related information, see the security chapter titled <link linkend="security.globals">Using Register Globals</link>. These individual globals are not superglobals. </simpara> </refsect1> <refsect1 role="changelog"> &reftitle.changelog; <para> <informaltable> <tgroup cols="2"> <thead> <row> <entry>&Version;</entry> <entry>&Description;</entry> </row> </thead> <tbody> <row> <entry>4.1.0</entry> <entry> Introduced <varname>$_SESSION</varname>. In previous the <varname>$HTTP_SESSION_VARS</varname> contained these information. </entry> </row> </tbody> </tgroup> </informaltable> </para> </refsect1> <refsect1 role="notes"> &reftitle.notes; ¬e.is-superglobal; </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t indent-tabs-mode:nil sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 -->
http://cvs.php.net/viewvc.cgi/phpdoc/en/language-snippets.ent?r1=1.219&r2=1.220&diff_format=u Index: phpdoc/en/language-snippets.ent diff -u phpdoc/en/language-snippets.ent:1.219 phpdoc/en/language-snippets.ent:1.220 --- phpdoc/en/language-snippets.ent:1.219 Tue Mar 25 03:21:33 2008 +++ phpdoc/en/language-snippets.ent Mon Apr 14 17:28:03 2008 @@ -1,4 +1,4 @@ -<!-- $Revision: 1.219 $ --> +<!-- $Revision: 1.220 $ --> <!-- Keep 'em sorted --> @@ -65,6 +65,12 @@ discourages developers from relying on this directive, and encouragees the use of other means, such as the &link.superglobals;.</para></note>'> +<!ENTITY note.is-superglobal "<note><para>This is a 'superglobal', or +automatic global, variable. This simply means that it is available in +all scopes throughout a script. There is no need to do +<command>global $variable;</command> to access it within functions or methods. +</para></note>"> + <!ENTITY note.superglobals '<note><title>Superglobals: availability note </title><para>Superglobal arrays such as <varname>$_GET</varname>, <varname>$_POST</varname>, and <varname>$_SERVER</varname>, etc. are available http://cvs.php.net/viewvc.cgi/phpdoc/en/appendices/reserved.xml?r1=1.72&r2=1.73&diff_format=u Index: phpdoc/en/appendices/reserved.xml diff -u phpdoc/en/appendices/reserved.xml:1.72 phpdoc/en/appendices/reserved.xml:1.73 --- phpdoc/en/appendices/reserved.xml:1.72 Tue Feb 19 21:45:29 2008 +++ phpdoc/en/appendices/reserved.xml Mon Apr 14 17:28:03 2008 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.72 $ --> +<!-- $Revision: 1.73 $ --> <appendix xml:id="reserved" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"> <title>List of Reserved Words</title> @@ -284,861 +284,6 @@ </table> </sect1> - <sect1 xml:id="reserved.variables"> - <title>Predefined Variables</title> - - <para> - Since PHP 4.1.0, the preferred method for retrieving - <link linkend="language.variables.external">external variables</link> is - with the superglobals mentioned below. Before this time, people relied - on either <link linkend="ini.register-globals">register_globals</link> - or the long predefined PHP arrays (<varname>$HTTP_*_VARS</varname>). - - &avail.register-long-arrays; - </para> - - <sect2 xml:id="reserved.variables.server"> - <title>Server variables: <varname>$_SERVER</varname></title> - <note> - <simpara> - Introduced in 4.1.0. In earlier versions, use - <varname>$HTTP_SERVER_VARS</varname>. - </simpara> - </note> - - <simpara> - <varname>$_SERVER</varname> 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 <link - xlink:href="&url.cgispec;">CGI 1.1 specification</link>, so you should - be able to expect those. - </simpara> - - <simpara> - This is a 'superglobal', or automatic global, variable. This - simply means that it is available in all scopes throughout a - script. You don't need to do a <command>global - $_SERVER;</command> to access it within functions or methods, as - you do with <varname>$HTTP_SERVER_VARS</varname>. - </simpara> - - <simpara> - <varname>$HTTP_SERVER_VARS</varname> contains the same initial - information, but is not a superglobal. (Note that - <varname>$HTTP_SERVER_VARS</varname> and <varname>$_SERVER</varname> - are different variables and that PHP handles them as such) - </simpara> - - <simpara> - If the <link - linkend="ini.register-globals">register_globals</link> directive - is set, then these variables will also be made available in the - global scope of the script; i.e., separate from the - <varname>$_SERVER</varname> and <varname>$HTTP_SERVER_VARS</varname> - arrays. For related information, see the security chapter titled - <link linkend="security.globals">Using Register - Globals</link>. These individual globals are not superglobals. - </simpara> - - <simpara> - You may or may not find any of the following elements in - $_SERVER. Note that few, if any, of these will be available (or - indeed have any meaning) if running PHP on the command line. - </simpara> - - <para> - <variablelist> - <varlistentry> - <term>'<varname>PHP_SELF</varname>'</term> - <listitem> - <simpara> - The filename of the currently executing script, relative to - the document root. For instance, - <varname>$_SERVER['PHP_SELF']</varname> in a script at the - address <filename>http://example.com/test.php/foo.bar</filename> - would be <filename>/test.php/foo.bar</filename>. - The <link linkend="language.constants.predefined">__FILE__</link> - constant contains the full path and filename of the current (i.e. - included) file. - </simpara> - <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. - </simpara> - </listitem> - </varlistentry> - - <varlistentry> - <term>'<varname>argv</varname>'</term> - <listitem> - <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. - </simpara> - </listitem> - </varlistentry> - - <varlistentry> - <term>'<varname>argc</varname>'</term> - <listitem> - <simpara> - Contains the number of command line parameters passed to the - script (if run on the command line). - </simpara> - </listitem> - </varlistentry> - - <varlistentry> - <term>'<varname>GATEWAY_INTERFACE</varname>'</term> - <listitem> - <simpara> - What revision of the CGI specification the server is using; - i.e. '<literal>CGI/1.1</literal>'. - </simpara> - </listitem> - </varlistentry> - - <varlistentry> - <term>'<varname>SERVER_ADDR</varname>'</term> - <listitem> - <simpara> - The IP address of the server under which the current script is - executing. - </simpara> - </listitem> - </varlistentry> - - <varlistentry> - <term>'<varname>SERVER_NAME</varname>'</term> - <listitem> - <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. - </simpara> - </listitem> - </varlistentry> - - <varlistentry> - <term>'<varname>SERVER_SOFTWARE</varname>'</term> - <listitem> - <simpara> - Server identification string, given in the headers when - responding to requests. - </simpara> - </listitem> - </varlistentry> - - <varlistentry> - <term>'<varname>SERVER_PROTOCOL</varname>'</term> - <listitem> - <simpara> - Name and revision of the information protocol via which the - page was requested; i.e. '<literal>HTTP/1.0</literal>'; - </simpara> - </listitem> - </varlistentry> - - <varlistentry> - <term>'<varname>REQUEST_METHOD</varname>'</term> - <listitem> - <simpara> - Which request method was used to access the page; i.e. '<literal>GET</literal>', - '<literal>HEAD</literal>', '<literal>POST</literal>', '<literal>PUT</literal>'. - </simpara> - <note> - <para> - PHP script is terminated after sending headers (it means after - producing any output without output buffering) if the request method - was <literal>HEAD</literal>. - </para> - </note> - </listitem> - </varlistentry> - - <varlistentry> - <term>'<varname>REQUEST_TIME</varname>'</term> - <listitem> - <simpara> - The timestamp of the start of the request. Available since PHP 5.1.0. - </simpara> - </listitem> - </varlistentry> - - <varlistentry> - <term>'<varname>QUERY_STRING</varname>'</term> - <listitem> - <simpara> - The query string, if any, via which the page was accessed. - </simpara> - </listitem> - </varlistentry> - - <varlistentry> - <term>'<varname>DOCUMENT_ROOT</varname>'</term> - <listitem> - <simpara> - The document root directory under which the current script is - executing, as defined in the server's configuration file. - </simpara> - </listitem> - </varlistentry> - - <varlistentry> - <term>'<varname>HTTP_ACCEPT</varname>'</term> - <listitem> - <simpara> - Contents of the <literal>Accept:</literal> header from the - current request, if there is one. - </simpara> - </listitem> - </varlistentry> - - <varlistentry> - <term>'<varname>HTTP_ACCEPT_CHARSET</varname>'</term> - <listitem> - <simpara> - Contents of the <literal>Accept-Charset:</literal> header - from the current request, if there is one. Example: - '<literal>iso-8859-1,*,utf-8</literal>'. - </simpara> - </listitem> - </varlistentry> - - <varlistentry> - <term>'<varname>HTTP_ACCEPT_ENCODING</varname>'</term> - <listitem> - <simpara> - Contents of the <literal>Accept-Encoding:</literal> header - from the current request, if there is one. Example: '<literal>gzip</literal>'. - </simpara> - </listitem> - </varlistentry> - - <varlistentry> - <term>'<varname>HTTP_ACCEPT_LANGUAGE</varname>'</term> - <listitem> - <simpara> - Contents of the <literal>Accept-Language:</literal> header - from the current request, if there is one. Example: '<literal>en</literal>'. - </simpara> - </listitem> - </varlistentry> - - <varlistentry> - <term>'<varname>HTTP_CONNECTION</varname>'</term> - <listitem> - <simpara> - Contents of the <literal>Connection:</literal> header from - the current request, if there is one. Example: '<literal>Keep-Alive</literal>'. - </simpara> - </listitem> - </varlistentry> - - <varlistentry> - <term>'<varname>HTTP_HOST</varname>'</term> - <listitem> - <simpara> - Contents of the <literal>Host:</literal> header from the - current request, if there is one. - </simpara> - </listitem> - </varlistentry> - - <varlistentry> - <term>'<varname>HTTP_REFERER</varname>'</term> - <listitem> - <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 <varname>HTTP_REFERER</varname> as a feature. In - short, it cannot really be trusted. - </simpara> - </listitem> - </varlistentry> - - <varlistentry> - <term>'<varname>HTTP_USER_AGENT</varname>'</term> - <listitem> - <simpara> - Contents of the <literal>User-Agent:</literal> 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: <computeroutput>Mozilla/4.5 [en] (X11; U; - Linux 2.2.9 i586)</computeroutput>. Among other things, you - can use this value with <function>get_browser</function> to - tailor your page's output to the capabilities of the user - agent. - </simpara> - </listitem> - </varlistentry> - - <varlistentry> - <term>'<varname>HTTPS</varname>'</term> - <listitem> - <simpara> - Set to a non-empty value if the script was queried through the HTTPS - protocol. - </simpara> - <simpara> - Note that when using ISAPI with IIS, the value will be - <literal>off</literal> if the request was not made through the HTTPS - protocol. - </simpara> - </listitem> - </varlistentry> - - <varlistentry> - <term>'<varname>REMOTE_ADDR</varname>'</term> - <listitem> - <simpara> - The IP address from which the user is viewing the current - page. - </simpara> - </listitem> - </varlistentry> - - <varlistentry> - <term>'<varname>REMOTE_HOST</varname>'</term> - <listitem> - <simpara> - The Host name from which the user is viewing the current - page. The reverse dns lookup is based off the - <varname>REMOTE_ADDR</varname> of the user. - </simpara> - <note> - <simpara> - Your web server must be configured to create this variable. For - example in Apache you'll need <literal>HostnameLookups On</literal> - inside &httpd.conf; for it to exist. See also - <function>gethostbyaddr</function>. - </simpara> - </note> - </listitem> - </varlistentry> - - <varlistentry> - <term>'<varname>REMOTE_PORT</varname>'</term> - <listitem> - <simpara> - The port being used on the user's machine to communicate with - the web server. - </simpara> - </listitem> - </varlistentry> - - <varlistentry> - <term>'<varname>SCRIPT_FILENAME</varname>'</term> - <listitem> - <para> - The absolute pathname of the currently executing script. - <note> - <para> - If a script is executed with the CLI, as a relative path, - such as <filename>file.php</filename> or - <filename>../file.php</filename>, - <varname>$_SERVER['SCRIPT_FILENAME']</varname> will - contain the relative path specified by the user. - </para> - </note> - </para> - </listitem> - </varlistentry> - - <varlistentry> - <term>'<varname>SERVER_ADMIN</varname>'</term> - <listitem> - <simpara> - The value given to the SERVER_ADMIN (for Apache) directive in - the web server configuration file. If the script is running - on a virtual host, this will be the value defined for that - virtual host. - </simpara> - </listitem> - </varlistentry> - - <varlistentry> - <term>'<varname>SERVER_PORT</varname>'</term> - <listitem> - <simpara> - The port on the server machine being used by the web server - for communication. For default setups, this will be '<literal>80</literal>'; - using SSL, for instance, will change this to whatever your - defined secure HTTP port is. - </simpara> - </listitem> - </varlistentry> - - <varlistentry> - <term>'<varname>SERVER_SIGNATURE</varname>'</term> - <listitem> - <simpara> - String containing the server version and virtual host name - which are added to server-generated pages, if enabled. - </simpara> - </listitem> - </varlistentry> - - <varlistentry> - <term>'<varname>PATH_TRANSLATED</varname>'</term> - <listitem> - <simpara> - Filesystem- (not document root-) based path to the current - script, after the server has done any virtual-to-real - mapping. - </simpara> - <note> - <simpara> - As of PHP 4.3.2, <envar>PATH_TRANSLATED</envar> is no longer set - implicitly under the Apache 2 <acronym>SAPI</acronym> in contrast - to the situation in Apache 1, where it's set to the same value as - the <envar>SCRIPT_FILENAME</envar> server variable when it's not - populated by Apache. This change was made to comply with the - <acronym>CGI</acronym> specification that - <envar>PATH_TRANSLATED</envar> should only exist if - <envar>PATH_INFO</envar> is defined. - </simpara> - <simpara> - Apache 2 users may use <literal>AcceptPathInfo = On</literal> inside - <filename>httpd.conf</filename> to define <envar>PATH_INFO</envar>. - </simpara> - </note> - </listitem> - </varlistentry> - - <varlistentry> - <term>'<varname>SCRIPT_NAME</varname>'</term> - <listitem> - <simpara> - Contains the current script's path. This is useful for pages - which need to point to themselves. - The <link linkend="language.constants.predefined">__FILE__</link> - constant contains the full path and filename of the current (i.e. - included) file. - </simpara> - </listitem> - </varlistentry> - - <varlistentry> - <term>'<varname>REQUEST_URI</varname>'</term> - <listitem> - <simpara> - The URI which was given in order to access this page; for - instance, '<literal>/index.html</literal>'. - </simpara> - </listitem> - </varlistentry> - - <varlistentry> - <term>'<varname>PHP_AUTH_DIGEST</varname>'</term> - <listitem> - <simpara> - When running under Apache as module doing Digest HTTP authentication - this variable is set to the 'Authorization' header sent by the - client (which you should then use to make the appropriate - validation). - </simpara> - </listitem> - </varlistentry> - - <varlistentry> - <term>'<varname>PHP_AUTH_USER</varname>'</term> - <listitem> - <simpara> - When running under Apache or IIS (ISAPI on PHP 5) as module doing - HTTP authentication this variable is set to the username provided by - the user. - </simpara> - </listitem> - </varlistentry> - - <varlistentry> - <term>'<varname>PHP_AUTH_PW</varname>'</term> - <listitem> - <simpara> - When running under Apache or IIS (ISAPI on PHP 5) as module doing - HTTP authentication this variable is set to the password provided by - the user. - </simpara> - </listitem> - </varlistentry> - - <varlistentry> - <term>'<varname>AUTH_TYPE</varname>'</term> - <listitem> - <simpara> - When running under Apache as module doing HTTP authenticated this - variable is set to the authentication type. - </simpara> - </listitem> - </varlistentry> - - </variablelist> - </para> - - </sect2> - - <sect2 xml:id="reserved.variables.environment"> - <title>Environment variables: <varname>$_ENV</varname></title> - - <note> - <simpara> - Introduced in 4.1.0. In earlier versions, use - <varname>$HTTP_ENV_VARS</varname>. - </simpara> - </note> - - <simpara> - These variables are imported into PHP's global namespace from the - environment under which the PHP parser is running. Many are - provided by the shell under which PHP is running and different - systems are likely running different kinds of shells, a - definitive list is impossible. Please see your shell's - documentation for a list of defined environment variables. - </simpara> - - <simpara> - Other environment variables include the CGI variables, placed - there regardless of whether PHP is running as a server module or - CGI processor. - </simpara> - - <simpara> - This is a 'superglobal', or automatic global, variable. This - simply means that it is available in all scopes throughout a - script. You don't need to do a <command>global - $_ENV;</command> to access it within functions or methods, as - you do with <varname>$HTTP_ENV_VARS</varname>. - </simpara> - - <simpara> - <varname>$HTTP_ENV_VARS</varname> contains the same initial - information, but is not a superglobal. (Note that - <varname>$HTTP_ENV_VARS</varname> and <varname>$_ENV</varname> - are different variables and that PHP handles them as such) - </simpara> - - <simpara> - If the <link - linkend="ini.register-globals">register_globals</link> directive - is set, then these variables will also be made available in the - global scope of the script; i.e., separate from the - <varname>$_ENV</varname> and <varname>$HTTP_ENV_VARS</varname> - arrays. For related information, see the security chapter titled - <link linkend="security.globals">Using Register - Globals</link>. These individual globals are not superglobals. - </simpara> - </sect2> - - <sect2 xml:id="reserved.variables.cookies"> - <title>HTTP Cookies: <varname>$_COOKIE</varname></title> - - <note> - <simpara> - Introduced in 4.1.0. In earlier versions, use - <varname>$HTTP_COOKIE_VARS</varname>. - </simpara> - </note> - - <simpara> - An associative array of variables passed to the current script - via HTTP cookies. Automatically global in any scope. - </simpara> - - <simpara> - This is a 'superglobal', or automatic global, variable. This - simply means that it is available in all scopes throughout a - script. You don't need to do a <command>global - $_COOKIE;</command> to access it within functions or methods, as - you do with <varname>$HTTP_COOKIE_VARS</varname>. - </simpara> - - <simpara> - <varname>$HTTP_COOKIE_VARS</varname> contains the same initial - information, but is not a superglobal. (Note that - <varname>$HTTP_COOKIE_VARS</varname> and <varname>$_COOKIE</varname> - are different variables and that PHP handles them as such) - </simpara> - - <simpara> - If the <link - linkend="ini.register-globals">register_globals</link> directive - is set, then these variables will also be made available in the - global scope of the script; i.e., separate from the - <varname>$_COOKIE</varname> and <varname>$HTTP_COOKIE_VARS</varname> - arrays. For related information, see the security chapter titled - <link linkend="security.globals">Using Register - Globals</link>. These individual globals are not superglobals. - </simpara> - </sect2> - - <sect2 xml:id="reserved.variables.get"> - <title>HTTP GET variables: <varname>$_GET</varname></title> - - <note> - <simpara> - Introduced in 4.1.0. In earlier versions, use - <varname>$HTTP_GET_VARS</varname>. - </simpara> - </note> - - <simpara> - An associative array of variables passed to the current script - via the HTTP GET method. Automatically global in any scope. - </simpara> - - <simpara> - This is a 'superglobal', or automatic global, variable. This - simply means that it is available in all scopes throughout a - script. You don't need to do a <command>global - $_GET;</command> to access it within functions or methods, as - you do with <varname>$HTTP_GET_VARS</varname>. - </simpara> - - <simpara> - <varname>$HTTP_GET_VARS</varname> contains the same initial - information, but is not a superglobal. (Note that - <varname>$HTTP_GET_VARS</varname> and <varname>$_GET</varname> - are different variables and that PHP handles them as such) - </simpara> - - <simpara> - If the <link - linkend="ini.register-globals">register_globals</link> directive - is set, then these variables will also be made available in the - global scope of the script; i.e., separate from the - <varname>$_GET</varname> and <varname>$HTTP_GET_VARS</varname> - arrays. For related information, see the security chapter titled - <link linkend="security.globals">Using Register - Globals</link>. These individual globals are not superglobals. - </simpara> - </sect2> - - <sect2 xml:id="reserved.variables.post"> - <title>HTTP POST variables: <varname>$_POST</varname></title> - - <note> - <simpara> - Introduced in 4.1.0. In earlier versions, use - <varname>$HTTP_POST_VARS</varname>. - </simpara> - </note> - - <simpara> - An associative array of variables passed to the current script - via the HTTP POST method. Automatically global in any scope. - </simpara> - - <simpara> - This is a 'superglobal', or automatic global, variable. This - simply means that it is available in all scopes throughout a - script. You don't need to do a <command>global - $_POST;</command> to access it within functions or methods, as - you do with <varname>$HTTP_POST_VARS</varname>. - </simpara> - - <simpara> - <varname>$HTTP_POST_VARS</varname> contains the same initial - information, but is not a superglobal. (Note that - <varname>$HTTP_POST_VARS</varname> and <varname>$_POST</varname> - are different variables and that PHP handles them as such) - </simpara> - - <simpara> - If the <link - linkend="ini.register-globals">register_globals</link> directive - is set, then these variables will also be made available in the - global scope of the script; i.e., separate from the - <varname>$_POST</varname> and <varname>$HTTP_POST_VARS</varname> - arrays. For related information, see the security chapter titled - <link linkend="security.globals">Using Register - Globals</link>. These individual globals are not superglobals. - </simpara> - </sect2> - - <sect2 xml:id="reserved.variables.files"> - <title>HTTP File upload variables: <varname>$_FILES</varname></title> - - <note> - <simpara> - Introduced in 4.1.0. In earlier versions, use - <varname>$HTTP_POST_FILES</varname>. - </simpara> - </note> - - <simpara> - An associative array of items uploaded to the current script - via the HTTP POST method. Automatically global in any scope. - </simpara> - - <simpara> - This is a 'superglobal', or automatic global, variable. This - simply means that it is available in all scopes throughout a - script. You don't need to do a <command>global - $_FILES;</command> to access it within functions or methods, as - you do with <varname>$HTTP_POST_FILES</varname>. - </simpara> - - <simpara> - <varname>$HTTP_POST_FILES</varname> contains the same - information, but is not a superglobal. (Note that - <varname>$HTTP_POST_FILES</varname> and <varname>$_FILES</varname> - are different variables and that PHP handles them as such) - </simpara> - - <simpara> - If the <link - linkend="ini.register-globals">register_globals</link> directive - is set, then these variables will also be made available in the - global scope of the script; i.e., separate from the - <varname>$_FILES</varname> and <varname>$HTTP_POST_FILES</varname> - arrays. For related information, see the security chapter titled - <link linkend="security.globals">Using Register - Globals</link>. These individual globals are not superglobals. - </simpara> - </sect2> - - <sect2 xml:id="reserved.variables.request"> - <title>Request variables: <varname>$_REQUEST</varname></title> - - <note> - <simpara> - Introduced in 4.1.0. There is no equivalent array in earlier - versions. - </simpara> - </note> - <note> - <simpara> - Prior to PHP 4.3.0, <varname>$_FILES</varname> information was - also included in <varname>$_REQUEST</varname>. - </simpara> - </note> - - <simpara> - An associative array consisting of the contents of - <varname>$_GET</varname>, <varname>$_POST</varname>, - and <varname>$_COOKIE</varname>. - </simpara> - - <simpara> - This is a 'superglobal', or automatic global, variable. This - simply means that it is available in all scopes throughout a - script. You don't need to do a <command>global - $_REQUEST;</command> to access it within functions or methods. - </simpara> - - <simpara> - If the <link - linkend="ini.register-globals">register_globals</link> directive - is set, then these variables will also be made available in the - global scope of the script; i.e., separate from the - <varname>$_REQUEST</varname> array. For related information, see - the security chapter titled <link - linkend="security.globals">Using Register - Globals</link>. These individual globals are not superglobals. - </simpara> - </sect2> - - <sect2 xml:id="reserved.variables.session"> - <title>Session variables: <varname>$_SESSION</varname></title> - - <note> - <simpara> - Introduced in 4.1.0. In earlier versions, use - <varname>$HTTP_SESSION_VARS</varname>. - </simpara> - </note> - - <simpara> - An associative array containing session variables available to - the current script. See the <link linkend="ref.session">Session - functions</link> documentation for more information on how this - is used. - </simpara> - - <simpara> - This is a 'superglobal', or automatic global, variable. This - simply means that it is available in all scopes throughout a - script. You don't need to do a <command>global - $_SESSION;</command> to access it within functions or methods, as - you do with <varname>$HTTP_SESSION_VARS</varname>. - </simpara> - - <simpara> - <varname>$HTTP_SESSION_VARS</varname> contains the same - information, but is not a superglobal. (Note that - <varname>$HTTP_SESSION_VARS</varname> and <varname>$_SESSION</varname> - are different variables and that PHP handles them as such) - </simpara> - - <simpara> - If the <link - linkend="ini.register-globals">register_globals</link> directive - is set, then these variables will also be made available in the - global scope of the script; i.e., separate from the - <varname>$_SESSION</varname> and <varname>$HTTP_SESSION_VARS</varname> - arrays. For related information, see the security chapter titled - <link linkend="security.globals">Using Register - Globals</link>. These individual globals are not superglobals. - </simpara> - </sect2> - - <sect2 xml:id="reserved.variables.globals"> - <title>Global variables: <varname>$GLOBALS</varname></title> - - <simpara> - An associative array containing references to all variables which - are currently defined in the global scope of the script. The - variable names are the keys of the array. - </simpara> - - <simpara> - This is a 'superglobal', or automatic global, variable. This - simply means that it is available in all scopes throughout a - script. You don't need to do a <command>global - $GLOBALS;</command> to access it within functions or methods. - </simpara> - - </sect2> - - <sect2 xml:id="reserved.variables.phperrormsg"> - <title>The previous error message: <varname>$php_errormsg</varname></title> - <simpara> - <varname>$php_errormsg</varname> is a variable containing the - text of the last error message generated by PHP. This variable - will only be available within the scope in which the error - occurred, and only if the <link - linkend="ini.track-errors">track_errors</link> configuration - option is turned on (it defaults to off). - </simpara> - </sect2> - - <sect2 xml:id="reserved.variables.httprawpostdata"> - <title>Raw POST data: <varname>$HTTP_RAW_POST_DATA</varname></title> - <para> - <varname>$HTTP_RAW_POST_DATA</varname> contains the raw POST data. - See <link linkend="ini.always-populate-raw-post-data">always_populate_raw_post_data</link> - </para> - </sect2> - - <sect2 xml:id="reserved.variables.httpresponseheader"> - <title>HTTP response headers: <varname>$http_response_header</varname></title> - <para> - The <varname>$http_response_header</varname> array is similiar to the - <function>get_headers</function> function. When using the - <link linkend="wrappers.http">HTTP wrapper</link> - <varname>$http_response_header</varname> will be populated with the HTTP - response headers. - </para> - </sect2> - - </sect1> <sect1 xml:id="reserved.classes"> <title>Predefined Classes</title> <para> http://cvs.php.net/viewvc.cgi/phpdoc/en/language/variables.xml?r1=1.99&r2=1.100&diff_format=u Index: phpdoc/en/language/variables.xml diff -u phpdoc/en/language/variables.xml:1.99 phpdoc/en/language/variables.xml:1.100 --- phpdoc/en/language/variables.xml:1.99 Tue Feb 19 21:45:29 2008 +++ phpdoc/en/language/variables.xml Mon Apr 14 17:28:03 2008 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.99 $ --> +<!-- $Revision: 1.100 $ --> <chapter xml:id="language.variables" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"> <title>Variables</title> @@ -233,126 +233,6 @@ linkend="ini.variables-order">variables_order</link> are not set, their appropriate PHP predefined arrays are also left empty. </para> - - <variablelist xml:id="language.variables.superglobals"> - <title>PHP Superglobals</title> - <varlistentry> - <term><link linkend="reserved.variables.globals">$GLOBALS</link></term> - <listitem> - <simpara> - Contains a reference to every variable which is currently - available within the global scope of the script. The keys of - this array are the names of the global variables. - </simpara> - </listitem> - </varlistentry> - <varlistentry> - <term><link linkend="reserved.variables.server">$_SERVER</link></term> - <listitem> - <simpara> - Variables set by the web server or otherwise directly related - to the execution environment of the current script. Analogous - to the old <varname>$HTTP_SERVER_VARS</varname> array (which is - still available, but deprecated). - </simpara> - </listitem> - </varlistentry> - <varlistentry> - <term><link linkend="reserved.variables.get">$_GET</link></term> - <listitem> - <simpara> - Variables provided to the script via URL query string. Analogous to the - old <varname>$HTTP_GET_VARS</varname> array (which is still - available, but deprecated). - </simpara> - </listitem> - </varlistentry> - <varlistentry> - <term><link linkend="reserved.variables.post">$_POST</link></term> - <listitem> - <simpara> - Variables provided to the script via HTTP POST. Analogous to the - old <varname>$HTTP_POST_VARS</varname> array (which is still - available, but deprecated). - </simpara> - </listitem> - </varlistentry> - <varlistentry> - <term><link linkend="reserved.variables.cookies">$_COOKIE</link></term> - <listitem> - <simpara> - Variables provided to the script via HTTP cookies. Analogous to - the old <varname>$HTTP_COOKIE_VARS</varname> array (which is - still available, but deprecated). - </simpara> - </listitem> - </varlistentry> - <varlistentry> - <term><link linkend="reserved.variables.files">$_FILES</link></term> - <listitem> - <simpara> - Variables provided to the script via HTTP post file - uploads. Analogous to the old - <varname>$HTTP_POST_FILES</varname> array (which is still - available, but deprecated). See <link - linkend="features.file-upload.post-method">POST method - uploads</link> for more information. - </simpara> - </listitem> - </varlistentry> - <varlistentry> - <term><link linkend="reserved.variables.environment">$_ENV</link></term> - <listitem> - <simpara> - Variables provided to the script via the environment. Analogous - to the old <varname>$HTTP_ENV_VARS</varname> array (which is - still available, but deprecated). - </simpara> - </listitem> - </varlistentry> - <varlistentry> - <term><link linkend="reserved.variables.request">$_REQUEST</link></term> - <listitem> - <simpara> - Variables provided to the script via the GET, POST, and COOKIE input - mechanisms, and which therefore cannot be trusted. The presence and - order of variable inclusion in this array is defined according to the - PHP <link linkend="ini.variables-order">variables_order</link> - configuration directive. This array has no direct analogue in versions - of PHP prior to 4.1.0. See also - <function>import_request_variables</function>. - </simpara> - <caution> - <simpara> - Since PHP 4.3.0, FILE information from <varname>$_FILES</varname> does - not exist in <varname>$_REQUEST</varname>. - </simpara> - </caution> - <note> - <simpara> - When running on the <link linkend="features.commandline">command line - </link>, this will <emphasis>not</emphasis> include the - <varname>argv</varname> and <varname>argc</varname> entries; these are - present in the <varname>$_SERVER</varname> array. - </simpara> - </note> - </listitem> - </varlistentry> - <varlistentry> - <term><link linkend="reserved.variables.session">$_SESSION</link></term> - <listitem> - <simpara> - Variables which are currently registered to a script's - session. Analogous to the old - <varname>$HTTP_SESSION_VARS</varname> array (which is still - available, but deprecated). See the <link - linkend="ref.session">Session handling functions</link> section - for more information. - </simpara> - </listitem> - </varlistentry> - </variablelist> - </sect1> http://cvs.php.net/viewvc.cgi/phpdoc/en/language/predefined/variables.xml?view=markup&rev=1.1 Index: phpdoc/en/language/predefined/variables.xml +++ phpdoc/en/language/predefined/variables.xml <?xml version="1.0" encoding="utf-8"?> <!-- $Revision: 1.1 $ --> <reference xml:id="reserved.variables" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"> <title>Predefined variables</title> <partintro> <para> PHP provides a large number of predefined variables to any script. The variables represent everything from <link linkend="language.variables.external">external variables</link> to built-in enviroment variables, last error messages to last retrieved headers. </para> <section xml:id="language.variables.superglobals"> <title>Superglobals</title> <para> Superglobals are built-in variables that are always available in all scopes. These variables are: <simplelist> <member><varname>$GLOBALS</varname></member> <member><varname>$_SERVER</varname></member> <member><varname>$_GET</varname></member> <member><varname>$_POST</varname></member> <member><varname>$_FILES</varname></member> <member><varname>$_COOKIE</varname></member> <member><varname>$_SESSION</varname></member> <member><varname>$_REQUEST</varname></member> <member><varname>$_ENV</varname></member> </simplelist> </para> <note> <simpara> Superglobals cannot be used as <link linkend="language.variables.variable">variable variables</link> inside functions or class methods. </simpara> </note> </section> </partintro> &language.predefined.variables.globals; &language.predefined.variables.server; &language.predefined.variables.get; &language.predefined.variables.post; &language.predefined.variables.files; &language.predefined.variables.request; &language.predefined.variables.session; &language.predefined.variables.env; &language.predefined.variables.cookie; &language.predefined.variables.phperrormsg; &language.predefined.variables.httprawpostdata; &language.predefined.variables.httpresponseheader; &language.predefined.variables.argc; &language.predefined.variables.argv; </reference> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t indent-tabs-mode:nil sgml-parent-document:nil sgml-default-dtd-file:"../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> http://cvs.php.net/viewvc.cgi/phpdoc/en/language/predefined/variables/argc.xml?view=markup&rev=1.1 Index: phpdoc/en/language/predefined/variables/argc.xml +++ phpdoc/en/language/predefined/variables/argc.xml <?xml version="1.0" encoding="utf-8"?> <!-- $Revision: 1.1 $ --> <refentry xml:id="reserved.variables.argc" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"> <refnamediv> <refname>$argc</refname> <refpurpose>The number of arguments passed to script</refpurpose> </refnamediv> <refsect1 role="description"> &reftitle.description; <para> Contains the number of arguments passed to the current script when running from the command line. </para> <note> <simpara> The script's filename is always passed as an argument to the script </simpara> </note> <note> <simpara> This variable is only available when <literal>register_argc_argv</literal> is enabled in <filename>php.ini</filename>. </simpara> </note> </refsect1> <refsect1 role="examples"> &reftitle.examples; <para> <example xml:id="variable.argc.basic"> <title><varname>$argc</varname> example</title> <programlisting role="php"> <![CDATA[ <?php var_dump($argc); ?> ]]> </programlisting> <simpara> When executing the example with: php script.php arg1 arg2 arg3 </simpara> &example.outputs.similar; <screen> <![CDATA[ int(4) ]]> </screen> </example> </para> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t indent-tabs-mode:nil sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> http://cvs.php.net/viewvc.cgi/phpdoc/en/language/predefined/variables/argv.xml?view=markup&rev=1.1 Index: phpdoc/en/language/predefined/variables/argv.xml +++ phpdoc/en/language/predefined/variables/argv.xml <?xml version="1.0" encoding="utf-8"?> <!-- $Revision: 1.1 $ --> <refentry xml:id="reserved.variables.argv" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"> <refnamediv> <refname>$argv</refname> <refpurpose>Array of arguments passed to script</refpurpose> </refnamediv> <refsect1 role="description"> &reftitle.description; <para> Contains an array of all the arguments passed to the script when running from the command line. </para> <note> <simpara> The first argument is always the current script's filename. </simpara> </note> <note> <simpara> This variable is only available when <literal>register_argc_argv</literal> is enabled in <filename>php.ini</filename>. </simpara> </note> </refsect1> <refsect1 role="examples"> &reftitle.examples; <para> <example xml:id="variable.argv.basic"> <title><varname>$argv</varname> example</title> <programlisting role="php"> <![CDATA[ <?php var_dump($argv); ?> ]]> </programlisting> <simpara> When executing the example with: php script.php arg1 arg2 arg3 </simpara> &example.outputs.similar; <screen> <![CDATA[ array(4) { [0]=> string(10) "script.php" [1]=> string(4) "arg1" [2]=> string(4) "arg2" [3]=> string(4) "arg3" } ]]> </screen> </example> </para> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t indent-tabs-mode:nil sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> http://cvs.php.net/viewvc.cgi/phpdoc/en/language/predefined/variables/cookie.xml?view=markup&rev=1.1 Index: phpdoc/en/language/predefined/variables/cookie.xml +++ phpdoc/en/language/predefined/variables/cookie.xml <?xml version="1.0" encoding="utf-8"?> <!-- $Revision: 1.1 $ --> <refentry xml:id="reserved.variables.cookies" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"> <refnamediv> <refname>$_COOKIE</refname> <refname>$HTTP_COOKIE_VARS</refname> <refpurpose>HTTP Cookies</refpurpose> </refnamediv> <refsect1 role="description"> &reftitle.description; <para> An associative array of variables passed to the current script via HTTP Cookies. </para> <simpara> <varname>$HTTP_COOKIE_VARS</varname> contains the same initial information, but is not a superglobal. (Note that <varname>$HTTP_COOKIE_VARS</varname> and <varname>$_COOKIE</varname> are different variables and that PHP handles them as such) </simpara> <simpara> If the <link linkend="ini.register-globals">register_globals</link> directive is set, then these variables will also be made available in the global scope of the script; i.e., separate from the <varname>$_COOKIE</varname> and <varname>$HTTP_COOKIE_VARS</varname> arrays. For related information, see the security chapter titled <link linkend="security.globals">Using Register Globals</link>. These individual globals are not superglobals. </simpara> </refsect1> <refsect1 role="changelog"> &reftitle.changelog; <para> <informaltable> <tgroup cols="2"> <thead> <row> <entry>&Version;</entry> <entry>&Description;</entry> </row> </thead> <tbody> <row> <entry>4.1.0</entry> <entry> Introduced <varname>$_COOKIE</varname>. In previous the <varname>$HTTP_COOKIE_VARS</varname> contained these information. </entry> </row> </tbody> </tgroup> </informaltable> </para> </refsect1> <refsect1 role="examples"> &reftitle.examples; <para> <example xml:id="variable.cookie.basic"> <title><varname>$_COOKIE</varname> example</title> <programlisting role="php"> <![CDATA[ <?php echo 'Hello ' . htmlspecialchars($_COOKIE["name"]) . '!'; ?> ]]> </programlisting> <simpara> Assuming the "name" cookie has been set earlier </simpara> &example.outputs.similar; <screen> <![CDATA[ Hello Hannes! ]]> </screen> </example> </para> </refsect1> <refsect1 role="notes"> &reftitle.notes; ¬e.is-superglobal; </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t indent-tabs-mode:nil sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> http://cvs.php.net/viewvc.cgi/phpdoc/en/language/predefined/variables/env.xml?view=markup&rev=1.1 Index: phpdoc/en/language/predefined/variables/env.xml +++ phpdoc/en/language/predefined/variables/env.xml <?xml version="1.0" encoding="utf-8"?> <!-- $Revision: 1.1 $ --> <refentry xml:id="reserved.variables.environment" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"> <refnamediv> <refname>$_ENV</refname> <refname>$HTTP_ENV_VARS</refname> <refpurpose>Environment variables</refpurpose> </refnamediv> <refsect1 role="description"> &reftitle.description; <para> An associative array of variables passed to the current script via the environment method. </para> <simpara> These variables are imported into PHP's global namespace from the environment under which the PHP parser is running. Many are provided by the shell under which PHP is running and different systems are likely running different kinds of shells, a definitive list is impossible. Please see your shell's documentation for a list of defined environment variables. </simpara> <simpara> Other environment variables include the CGI variables, placed there regardless of whether PHP is running as a server module or CGI processor. </simpara> <simpara> <varname>$HTTP_ENV_VARS</varname> contains the same initial information, but is not a superglobal. (Note that <varname>$HTTP_ENV_VARS</varname> and <varname>$_ENV</varname> are different variables and that PHP handles them as such) </simpara> <simpara> If the <link linkend="ini.register-globals">register_globals</link> directive is set, then these variables will also be made available in the global scope of the script; i.e., separate from the <varname>$_ENV</varname> and <varname>$HTTP_ENV_VARS</varname> arrays. For related information, see the security chapter titled <link linkend="security.globals">Using Register Globals</link>. These individual globals are not superglobals. </simpara> </refsect1> <refsect1 role="changelog"> &reftitle.changelog; <para> <informaltable> <tgroup cols="2"> <thead> <row> <entry>&Version;</entry> <entry>&Description;</entry> </row> </thead> <tbody> <row> <entry>4.1.0</entry> <entry> Introduced <varname>$_ENV</varname>. In previous the <varname>$HTTP_ENV_VARS</varname> contained these information. </entry> </row> </tbody> </tgroup> </informaltable> </para> </refsect1> <refsect1 role="examples"> &reftitle.examples; <para> <example xml:id="variable.env.basic"> <title><varname>$_ENV</varname> example</title> <programlisting role="php"> <![CDATA[ <?php echo 'My username is ' .$_ENV["user"] . '!'; ?> ]]> </programlisting> <simpara> Assuming "bjori" executes this script </simpara> &example.outputs.similar; <screen> <![CDATA[ My username is bjori! ]]> </screen> </example> </para> </refsect1> <refsect1 role="notes"> &reftitle.notes; ¬e.is-superglobal; </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t indent-tabs-mode:nil sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> http://cvs.php.net/viewvc.cgi/phpdoc/en/language/predefined/variables/files.xml?view=markup&rev=1.1 Index: phpdoc/en/language/predefined/variables/files.xml +++ phpdoc/en/language/predefined/variables/files.xml <?xml version="1.0" encoding="utf-8"?> <!-- $Revision: 1.1 $ --> <refentry xml:id="reserved.variables.files" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"> <refnamediv> <refname>$_FILES</refname> <refname>$HTTP_POST_FILES</refname> <refpurpose>HTTP File Upload variables</refpurpose> </refnamediv> <refsect1 role="description"> &reftitle.description; <para> An associative array of items uploaded to the current script via the HTTP POST method. </para> <simpara> <varname>$HTTP_POST_FILES</varname> contains the same initial information, but is not a superglobal. (Note that <varname>$HTTP_POST_FILES</varname> and <varname>$_FILES</varname> are different variables and that PHP handles them as such) </simpara> <simpara> If the <link linkend="ini.register-globals">register_globals</link> directive is set, then these variables will also be made available in the global scope of the script; i.e., separate from the <varname>$_FILES</varname> and <varname>$HTTP_POST_FILES</varname> arrays. For related information, see the security chapter titled <link linkend="security.globals">Using Register Globals</link>. These individual globals are not superglobals. </simpara> </refsect1> <refsect1 role="changelog"> &reftitle.changelog; <para> <informaltable> <tgroup cols="2"> <thead> <row> <entry>&Version;</entry> <entry>&Description;</entry> </row> </thead> <tbody> <row> <entry>4.1.0</entry> <entry> Introduced <varname>$_FILES</varname>. In previous the <varname>$HTTP_POST_FILES</varname> contained these information. </entry> </row> </tbody> </tgroup> </informaltable> </para> </refsect1> <refsect1 role="notes"> &reftitle.notes; ¬e.is-superglobal; </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t indent-tabs-mode:nil sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> http://cvs.php.net/viewvc.cgi/phpdoc/en/language/predefined/variables/get.xml?view=markup&rev=1.1 Index: phpdoc/en/language/predefined/variables/get.xml +++ phpdoc/en/language/predefined/variables/get.xml <?xml version="1.0" encoding="utf-8"?> <!-- $Revision: 1.1 $ --> <refentry xml:id="reserved.variables.get" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"> <refnamediv> <refname>$_GET</refname> <refname>$HTTP_GET_VARS</refname> <refpurpose>HTTP GET variables</refpurpose> </refnamediv> <refsect1 role="description"> &reftitle.description; <para> An associative array of variables passed to the current script via the HTTP GET method. </para> <simpara> <varname>$HTTP_GET_VARS</varname> contains the same initial information, but is not a superglobal. (Note that <varname>$HTTP_GET_VARS</varname> and <varname>$_GET</varname> are different variables and that PHP handles them as such) </simpara> <simpara> If the <link linkend="ini.register-globals">register_globals</link> directive is set, then these variables will also be made available in the global scope of the script; i.e., separate from the <varname>$_GET</varname> and <varname>$HTTP_GET_VARS</varname> arrays. For related information, see the security chapter titled <link linkend="security.globals">Using Register Globals</link>. These individual globals are not superglobals. </simpara> </refsect1> <refsect1 role="changelog"> &reftitle.changelog; <para> <informaltable> <tgroup cols="2"> <thead> <row> <entry>&Version;</entry> <entry>&Description;</entry> </row> </thead> <tbody> <row> <entry>4.1.0</entry> <entry> Introduced <varname>$_GET</varname>. In previous the <varname>$HTTP_GET_VARS</varname> contained these information. </entry> </row> </tbody> </tgroup> </informaltable> </para> </refsect1> <refsect1 role="examples"> &reftitle.examples; <para> <example xml:id="variable.get.basic"> <title><varname>$_GET</varname> example</title> <programlisting role="php"> <![CDATA[ <?php echo 'Hello ' . htmlspecialchars($_GET["name"]) . '!'; ?> ]]> </programlisting> <simpara> Assuming the user entered http://example.com/?name=Hannes </simpara> &example.outputs.similar; <screen> <![CDATA[ Hello Hannes! ]]> </screen> </example> </para> </refsect1> <refsect1 role="notes"> &reftitle.notes; ¬e.is-superglobal; </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t indent-tabs-mode:nil sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> http://cvs.php.net/viewvc.cgi/phpdoc/en/language/predefined/variables/globals.xml?view=markup&rev=1.1 Index: phpdoc/en/language/predefined/variables/globals.xml +++ phpdoc/en/language/predefined/variables/globals.xml <?xml version="1.0" encoding="utf-8"?> <!-- $Revision: 1.1 $ --> <refentry xml:id="variable.globals" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"> <refnamediv> <refname>$GLOBALS</refname> <refpurpose>References all variables available in global scope</refpurpose> </refnamediv> <refsect1 role="description"> &reftitle.description; <para> An associative array containing references to all variables which are currently defined in the global scope of the script. The variable names are the keys of the array. </para> </refsect1> <refsect1 role="examples"> &reftitle.examples; <para> <example xml:id="variable.globals.basic"> <title><varname>$GLOBALS</varname> example</title> <programlisting role="php"> <![CDATA[ <?php function test() { $foo = "local variable"; echo '$foo in global scope: ' . $GLOBALS["foo"] . "\n"; echo '$foo in current scope: ' . $foo . "\n"; } $foo = "Example content"; test(); ?> ]]> </programlisting> &example.outputs.similar; <screen> <![CDATA[ $foo in global scope: Example content $foo in current scope: local variable ]]> </screen> </example> </para> </refsect1> <refsect1 role="notes"> &reftitle.notes; ¬e.is-superglobal; </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t indent-tabs-mode:nil sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> http://cvs.php.net/viewvc.cgi/phpdoc/en/language/predefined/variables/httprawpostdata.xml?view=markup&rev=1.1 Index: phpdoc/en/language/predefined/variables/httprawpostdata.xml +++ phpdoc/en/language/predefined/variables/httprawpostdata.xml <?xml version="1.0" encoding="utf-8"?> <!-- $Revision: 1.1 $ --> <refentry xml:id="reserved.variables.httprawpostdata" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"> <refnamediv> <refname>$HTTP_RAW_POST_DATA</refname> <refpurpose>Raw POST data</refpurpose> </refnamediv> <refsect1 role="description"> &reftitle.description; <para> <varname>$HTTP_RAW_POST_DATA</varname> contains the raw POST data. See <link linkend="ini.always-populate-raw-post-data">always_populate_raw_post_data</link> </para> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t indent-tabs-mode:nil sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> http://cvs.php.net/viewvc.cgi/phpdoc/en/language/predefined/variables/httpresponseheader.xml?view=markup&rev=1.1 Index: phpdoc/en/language/predefined/variables/httpresponseheader.xml +++ phpdoc/en/language/predefined/variables/httpresponseheader.xml <?xml version="1.0" encoding="utf-8"?> <!-- $Revision: 1.1 $ --> <refentry xml:id="reserved.variables.httpresponseheader" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"> <refnamediv> <refname>$http_response_header</refname> <refpurpose>HTTP response headers</refpurpose> </refnamediv> <refsect1 role="description"> &reftitle.description; <para> The <varname>$http_response_header</varname> array is similiar to the <function>get_headers</function> function. When using the <link linkend="wrappers.http">HTTP wrapper</link> <varname>$http_response_header</varname> will be populated with the HTTP response headers. </para> </refsect1> <refsect1 role="examples"> &reftitle.examples; <para> <example xml:id="variable.httpresponseheader.basic"> <title><varname>$http_response_header</varname> example</title> <programlisting role="php"> <![CDATA[ <?php file_get_contents("http://example.com"); var_dump($http_response_header); ?> ]]> </programlisting> &example.outputs.similar; <screen> <![CDATA[ array(9) { [0]=> string(15) "HTTP/1.1 200 OK" [1]=> string(35) "Date: Sat, 12 Apr 2008 17:30:38 GMT" [2]=> string(29) "Server: Apache/2.2.3 (CentOS)" [3]=> string(44) "Last-Modified: Tue, 15 Nov 2005 13:24:10 GMT" [4]=> string(27) "ETag: "280100-1b6-80bfd280"" [5]=> string(20) "Accept-Ranges: bytes" [6]=> string(19) "Content-Length: 438" [7]=> string(17) "Connection: close" [8]=> string(38) "Content-Type: text/html; charset=UTF-8" } ]]> </screen> </example> </para> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t indent-tabs-mode:nil sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> http://cvs.php.net/viewvc.cgi/phpdoc/en/language/predefined/variables/phperrormsg.xml?view=markup&rev=1.1 Index: phpdoc/en/language/predefined/variables/phperrormsg.xml +++ phpdoc/en/language/predefined/variables/phperrormsg.xml <?xml version="1.0" encoding="utf-8"?> <!-- $Revision: 1.1 $ --> <refentry xml:id="reserved.variables.phperrormsg" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"> <refnamediv> <refname>$php_errormsg</refname> <refpurpose>The previous error message</refpurpose> </refnamediv> <refsect1 role="description"> &reftitle.description; <para> <varname>$php_errormsg</varname> is a variable containing the text of the last error message generated by PHP. This variable will only be available within the scope in which the error occurred, and only if the <link linkend="ini.track-errors">track_errors</link> configuration option is turned on (it defaults to off). </para> <note> <simpara> This variable is only available when <literal>track_errors</literal> is enabled in <filename>php.ini</filename>. </simpara> </note> <warning> <simpara> If a <link linkend="function.set-error-handler">user defined error handler</link> is set <varname>$php_erromsg</varname> is only set if the error handler returns &false; </simpara> </warning> </refsect1> <refsect1 role="examples"> &reftitle.examples; <para> <example xml:id="variable.phperrormsg.basic"> <title><varname>$php_errormsg</varname> example</title> <programlisting role="php"> <![CDATA[ <?php @strpos(); echo $php_errormsg; ?> ]]> </programlisting> &example.outputs.similar; <screen> <![CDATA[ Wrong parameter count for strpos() ]]> </screen> </example> </para> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t indent-tabs-mode:nil sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> http://cvs.php.net/viewvc.cgi/phpdoc/en/language/predefined/variables/post.xml?view=markup&rev=1.1 Index: phpdoc/en/language/predefined/variables/post.xml +++ phpdoc/en/language/predefined/variables/post.xml <?xml version="1.0" encoding="utf-8"?> <!-- $Revision: 1.1 $ --> <refentry xml:id="reserved.variables.post" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"> <refnamediv> <refname>$_POST</refname> <refname>$HTTP_POST_VARS</refname> <refpurpose>HTTP POST variables</refpurpose> </refnamediv> <refsect1 role="description"> &reftitle.description; <para> An associative array of variables passed to the current script via the HTTP POST method. </para> <simpara> <varname>$HTTP_POST_VARS</varname> contains the same initial information, but is not a superglobal. (Note that <varname>$HTTP_POST_VARS</varname> and <varname>$_POST</varname> are different variables and that PHP handles them as such) </simpara> <simpara> If the <link linkend="ini.register-globals">register_globals</link> directive is set, then these variables will also be made available in the global scope of the script; i.e., separate from the <varname>$_POST</varname> and <varname>$HTTP_POST_VARS</varname> arrays. For related information, see the security chapter titled <link linkend="security.globals">Using Register Globals</link>. These individual globals are not superglobals. </simpara> </refsect1> <refsect1 role="changelog"> &reftitle.changelog; <para> <informaltable> <tgroup cols="2"> <thead> <row> <entry>&Version;</entry> <entry>&Description;</entry> </row> </thead> <tbody> <row> <entry>4.1.0</entry> <entry> Introduced <varname>$_POST</varname>. In previous the <varname>$HTTP_POST_VARS</varname> contained these information. </entry> </row> </tbody> </tgroup> </informaltable> </para> </refsect1> <refsect1 role="examples"> &reftitle.examples; <para> <example xml:id="variable.post.basic"> <title><varname>$_POST</varname> example</title> <programlisting role="php"> <![CDATA[ <?php echo 'Hello ' . htmlspecialchars($_POST["name"]) . '!'; ?> ]]> </programlisting> <simpara> Assuming the user POSTed name=Hannes </simpara> &example.outputs.similar; <screen> <![CDATA[ Hello Hannes! ]]> </screen> </example> </para> </refsect1> <refsect1 role="notes"> &reftitle.notes; ¬e.is-superglobal; </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t indent-tabs-mode:nil sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> http://cvs.php.net/viewvc.cgi/phpdoc/en/language/predefined/variables/request.xml?view=markup&rev=1.1 Index: phpdoc/en/language/predefined/variables/request.xml +++ phpdoc/en/language/predefined/variables/request.xml <?xml version="1.0" encoding="utf-8"?> <!-- $Revision: 1.1 $ --> <refentry xml:id="reserved.variables.request" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"> <refnamediv> <refname>$_REQUEST</refname> <refpurpose>Request variables</refpurpose> </refnamediv> <refsect1 role="description"> &reftitle.description; <para> An associative array consisting of the contents of <varname>$_GET</varname>, <varname>$_POST</varname>, and <varname>$_COOKIE</varname>. </para> <simpara> Variables provided to the script via the GET, POST, and COOKIE input mechanisms, and which therefore cannot be trusted. The presence and order of variable inclusion in this array is defined according to the PHP <link linkend="ini.variables-order">variables_order</link> configuration directive. This array has no direct analogue in versions of PHP prior to 4.1.0. </simpara> <simpara> When running on the <link linkend="features.commandline">command line </link>, this will <emphasis>not</emphasis> include the <varname>argv</varname> and <varname>argc</varname> entries; these are present in the <varname>$_SERVER</varname> array. </simpara> <simpara> If the <link linkend="ini.register-globals">register_globals</link> directive is set, then these variables will also be made available in the global scope of the script; i.e., separate from the <varname>$_REQUEST</varname> array. For related information, see the security chapter titled <link linkend="security.globals">Using Register Globals</link>. These individual globals are not superglobals. </simpara> </refsect1> <refsect1 role="changelog"> &reftitle.changelog; <para> <informaltable> <tgroup cols="2"> <thead> <row> <entry>&Version;</entry> <entry>&Description;</entry> </row> </thead> <tbody> <row> <entry>4.3.0</entry> <entry> <varname>$_FILES</varname> information was removed from <varname>$_REQUEST</varname>. </entry> </row> <row> <entry>4.1.0</entry> <entry> Introduced <varname>$_REQUEST</varname>. </entry> </row> </tbody> </tgroup> </informaltable> </para> </refsect1> <refsect1 role="notes"> &reftitle.notes; ¬e.is-superglobal; </refsect1> <refsect1 role="seealso"> &reftitle.seealso; <simplelist> <member><function>import_request_variables</function></member> </simplelist> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t indent-tabs-mode:nil sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> http://cvs.php.net/viewvc.cgi/phpdoc/en/language/predefined/variables/server.xml?view=markup&rev=1.1 Index: phpdoc/en/language/predefined/variables/server.xml +++ phpdoc/en/language/predefined/variables/server.xml <?xml version="1.0" encoding="utf-8"?> <!-- $Revision: 1.1 $ --> <refentry xml:id="reserved.variables.server" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"> <refnamediv> <refname>$_SERVER</refname> <refname>$HTTP_SERVER_VARS</refname> <refpurpose>Server and execution enviroment information</refpurpose> </refnamediv> <refsect1 role="description"> &reftitle.description; <para> <varname>$_SERVER</varname> 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 <link xlink:href="&url.cgispec;">CGI 1.1 specification</link>, so you should be able to expect those. </para> <simpara> <varname>$HTTP_SERVER_VARS</varname> contains the same initial information, but is not a superglobal. (Note that <varname>$HTTP_SERVER_VARS</varname> and <varname>$_SERVER</varname> are different variables and that PHP handles them as such) </simpara> <simpara> If the <link linkend="ini.register-globals">register_globals</link> directive is set, then these variables will also be made available in the global scope of the script; i.e., separate from the <varname>$_SERVER</varname> and <varname>$HTTP_SERVER_VARS</varname> arrays. For related information, see the security chapter titled <link linkend="security.globals">Using Register Globals</link>. These individual globals are not superglobals. </simpara> <simpara> You may or may not find any of the following elements in $_SERVER. Note that few, if any, of these will be available (or indeed have any meaning) if running PHP on the command line. </simpara> <para> <variablelist> <varlistentry> <term>'<varname>PHP_SELF</varname>'</term> <listitem> <simpara> The filename of the currently executing script, relative to the document root. For instance, <varname>$_SERVER['PHP_SELF']</varname> in a script at the address <filename>http://example.com/test.php/foo.bar</filename> would be <filename>/test.php/foo.bar</filename>. The <link linkend="language.constants.predefined">__FILE__</link> constant contains the full path and filename of the current (i.e. included) file. </simpara> <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. </simpara> </listitem> </varlistentry> <varlistentry> <term>'<varname>argv</varname>'</term> <listitem> <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. </simpara> </listitem> </varlistentry> <varlistentry> <term>'<varname>argc</varname>'</term> <listitem> <simpara> Contains the number of command line parameters passed to the script (if run on the command line). </simpara> </listitem> </varlistentry> <varlistentry> <term>'<varname>GATEWAY_INTERFACE</varname>'</term> <listitem> <simpara> What revision of the CGI specification the server is using; i.e. '<literal>CGI/1.1</literal>'. </simpara> </listitem> </varlistentry> <varlistentry> <term>'<varname>SERVER_ADDR</varname>'</term> <listitem> <simpara> The IP address of the server under which the current script is executing. </simpara> </listitem> </varlistentry> <varlistentry> <term>'<varname>SERVER_NAME</varname>'</term> <listitem> <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. </simpara> </listitem> </varlistentry> <varlistentry> <term>'<varname>SERVER_SOFTWARE</varname>'</term> <listitem> <simpara> Server identification string, given in the headers when responding to requests. </simpara> </listitem> </varlistentry> <varlistentry> <term>'<varname>SERVER_PROTOCOL</varname>'</term> <listitem> <simpara> Name and revision of the information protocol via which the page was requested; i.e. '<literal>HTTP/1.0</literal>'; </simpara> </listitem> </varlistentry> <varlistentry> <term>'<varname>REQUEST_METHOD</varname>'</term> <listitem> <simpara> Which request method was used to access the page; i.e. '<literal>GET</literal>', '<literal>HEAD</literal>', '<literal>POST</literal>', '<literal>PUT</literal>'. </simpara> <note> <para> PHP script is terminated after sending headers (it means after producing any output without output buffering) if the request method was <literal>HEAD</literal>. </para> </note> </listitem> </varlistentry> <varlistentry> <term>'<varname>REQUEST_TIME</varname>'</term> <listitem> <simpara> The timestamp of the start of the request. Available since PHP 5.1.0. </simpara> </listitem> </varlistentry> <varlistentry> <term>'<varname>QUERY_STRING</varname>'</term> <listitem> <simpara> The query string, if any, via which the page was accessed. </simpara> </listitem> </varlistentry> <varlistentry> <term>'<varname>DOCUMENT_ROOT</varname>'</term> <listitem> <simpara> The document root directory under which the current script is executing, as defined in the server's configuration file. </simpara> </listitem> </varlistentry> <varlistentry> <term>'<varname>HTTP_ACCEPT</varname>'</term> <listitem> <simpara> Contents of the <literal>Accept:</literal> header from the current request, if there is one. </simpara> </listitem> </varlistentry> <varlistentry> <term>'<varname>HTTP_ACCEPT_CHARSET</varname>'</term> <listitem> <simpara> Contents of the <literal>Accept-Charset:</literal> header from the current request, if there is one. Example: '<literal>iso-8859-1,*,utf-8</literal>'. </simpara> </listitem> </varlistentry> <varlistentry> <term>'<varname>HTTP_ACCEPT_ENCODING</varname>'</term> <listitem> <simpara> Contents of the <literal>Accept-Encoding:</literal> header from the current request, if there is one. Example: '<literal>gzip</literal>'. </simpara> </listitem> </varlistentry> <varlistentry> <term>'<varname>HTTP_ACCEPT_LANGUAGE</varname>'</term> <listitem> <simpara> Contents of the <literal>Accept-Language:</literal> header from the current request, if there is one. Example: '<literal>en</literal>'. </simpara> </listitem> </varlistentry> <varlistentry> <term>'<varname>HTTP_CONNECTION</varname>'</term> <listitem> <simpara> Contents of the <literal>Connection:</literal> header from the current request, if there is one. Example: '<literal>Keep-Alive</literal>'. </simpara> </listitem> </varlistentry> <varlistentry> <term>'<varname>HTTP_HOST</varname>'</term> <listitem> <simpara> Contents of the <literal>Host:</literal> header from the current request, if there is one. </simpara> </listitem> </varlistentry> <varlistentry> <term>'<varname>HTTP_REFERER</varname>'</term> <listitem> <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 <varname>HTTP_REFERER</varname> as a feature. In short, it cannot really be trusted. </simpara> </listitem> </varlistentry> <varlistentry> <term>'<varname>HTTP_USER_AGENT</varname>'</term> <listitem> <simpara> Contents of the <literal>User-Agent:</literal> 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: <computeroutput>Mozilla/4.5 [en] (X11; U; Linux 2.2.9 i586)</computeroutput>. Among other things, you can use this value with <function>get_browser</function> to tailor your page's output to the capabilities of the user agent. </simpara> </listitem> </varlistentry> <varlistentry> <term>'<varname>HTTPS</varname>'</term> <listitem> <simpara> Set to a non-empty value if the script was queried through the HTTPS protocol. </simpara> <simpara> Note that when using ISAPI with IIS, the value will be <literal>off</literal> if the request was not made through the HTTPS protocol. </simpara> </listitem> </varlistentry> <varlistentry> <term>'<varname>REMOTE_ADDR</varname>'</term> <listitem> <simpara> The IP address from which the user is viewing the current page. </simpara> </listitem> </varlistentry> <varlistentry> <term>'<varname>REMOTE_HOST</varname>'</term> <listitem> <simpara> The Host name from which the user is viewing the current page. The reverse dns lookup is based off the <varname>REMOTE_ADDR</varname> of the user. </simpara> <note> <simpara> Your web server must be configured to create this variable. For example in Apache you'll need <literal>HostnameLookups On</literal> inside &httpd.conf; for it to exist. See also <function>gethostbyaddr</function>. </simpara> </note> </listitem> </varlistentry> <varlistentry> <term>'<varname>REMOTE_PORT</varname>'</term> <listitem> <simpara> The port being used on the user's machine to communicate with the web server. </simpara> </listitem> </varlistentry> <varlistentry> <term>'<varname>SCRIPT_FILENAME</varname>'</term> <listitem> <para> The absolute pathname of the currently executing script. <note> <para> If a script is executed with the CLI, as a relative path, such as <filename>file.php</filename> or <filename>../file.php</filename>, <varname>$_SERVER['SCRIPT_FILENAME']</varname> will contain the relative path specified by the user. </para> </note> </para> </listitem> </varlistentry> <varlistentry> <term>'<varname>SERVER_ADMIN</varname>'</term> <listitem> <simpara> The value given to the SERVER_ADMIN (for Apache) directive in the web server configuration file. If the script is running on a virtual host, this will be the value defined for that virtual host. </simpara> </listitem> </varlistentry> <varlistentry> <term>'<varname>SERVER_PORT</varname>'</term> <listitem> <simpara> The port on the server machine being used by the web server for communication. For default setups, this will be '<literal>80</literal>'; using SSL, for instance, will change this to whatever your defined secure HTTP port is. </simpara> </listitem> </varlistentry> <varlistentry> <term>'<varname>SERVER_SIGNATURE</varname>'</term> <listitem> <simpara> String containing the server version and virtual host name which are added to server-generated pages, if enabled. </simpara> </listitem> </varlistentry> <varlistentry> <term>'<varname>PATH_TRANSLATED</varname>'</term> <listitem> <simpara> Filesystem- (not document root-) based path to the current script, after the server has done any virtual-to-real mapping. </simpara> <note> <simpara> As of PHP 4.3.2, <envar>PATH_TRANSLATED</envar> is no longer set implicitly under the Apache 2 <acronym>SAPI</acronym> in contrast to the situation in Apache 1, where it's set to the same value as the <envar>SCRIPT_FILENAME</envar> server variable when it's not populated by Apache. This change was made to comply with the <acronym>CGI</acronym> specification that <envar>PATH_TRANSLATED</envar> should only exist if <envar>PATH_INFO</envar> is defined. </simpara> <simpara> Apache 2 users may use <literal>AcceptPathInfo = On</literal> inside <filename>httpd.conf</filename> to define <envar>PATH_INFO</envar>. </simpara> </note> </listitem> </varlistentry> <varlistentry> <term>'<varname>SCRIPT_NAME</varname>'</term> <listitem> <simpara> Contains the current script's path. This is useful for pages which need to point to themselves. The <link linkend="language.constants.predefined">__FILE__</link> constant contains the full path and filename of the current (i.e. included) file. </simpara> </listitem> </varlistentry> <varlistentry> <term>'<varname>REQUEST_URI</varname>'</term> <listitem> <simpara> The URI which was given in order to access this page; for instance, '<literal>/index.html</literal>'. </simpara> </listitem> </varlistentry> <varlistentry> <term>'<varname>PHP_AUTH_DIGEST</varname>'</term> <listitem> <simpara> When running under Apache as module doing Digest HTTP authentication this variable is set to the 'Authorization' header sent by the client (which you should then use to make the appropriate validation). </simpara> </listitem> </varlistentry> <varlistentry> <term>'<varname>PHP_AUTH_USER</varname>'</term> <listitem> <simpara> When running under Apache or IIS (ISAPI on PHP 5) as module doing HTTP authentication this variable is set to the username provided by the user. </simpara> </listitem> </varlistentry> <varlistentry> <term>'<varname>PHP_AUTH_PW</varname>'</term> <listitem> <simpara> When running under Apache or IIS (ISAPI on PHP 5) as module doing HTTP authentication this variable is set to the password provided by the user. </simpara> </listitem> </varlistentry> <varlistentry> <term>'<varname>AUTH_TYPE</varname>'</term> <listitem> <simpara> When running under Apache as module doing HTTP authenticated this variable is set to the authentication type. </simpara> </listitem> </varlistentry> </variablelist> </para> </refsect1> <refsect1 role="changelog"> &reftitle.changelog; <para> <informaltable> <tgroup cols="2"> <thead> <row> <entry>&Version;</entry> <entry>&Description;</entry> </row> </thead> <tbody> <row> <entry>4.1.0</entry> <entry> Introduced <varname>$_SERVER</varname>. In previous versions the <varname>$HTTP_SERVER_VARS</varname> contained these information. </entry> </row> </tbody> </tgroup> </informaltable> </para> </refsect1> <refsect1 role="examples"> &reftitle.examples; <para> <example xml:id="variable.server.basic"> <title><varname>$_SERVER</varname> example</title> <programlisting role="php"> <![CDATA[ <?php var_dump($_SERVER["SERVER_NAME"]); ?> ]]> </programlisting> &example.outputs.similar; <screen> <![CDATA[ www.php.net ]]> </screen> </example> </para> </refsect1> <refsect1 role="notes"> &reftitle.notes; ¬e.is-superglobal; </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t indent-tabs-mode:nil sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> http://cvs.php.net/viewvc.cgi/phpdoc/en/language/predefined/variables/session.xml?view=markup&rev=1.1 Index: phpdoc/en/language/predefined/variables/session.xml +++ phpdoc/en/language/predefined/variables/session.xml <?xml version="1.0" encoding="utf-8"?> <!-- $Revision: 1.1 $ --> <refentry xml:id="reserved.variables.session" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"> <refnamediv> <refname>$_SESSION</refname> <refname>$HTTP_SESSION_VARS</refname> <refpurpose>Session variables</refpurpose> </refnamediv> <refsect1 role="description"> &reftitle.description; <para> An associative array containing session variables available to the current script. See the <link linkend="ref.session">Session functions</link> documentation for more information on how this is used. </para> <simpara> <varname>$HTTP_SESSION_VARS</varname> contains the same initial information, but is not a superglobal. (Note that <varname>$HTTP_SESSION_VARS</varname> and <varname>$_SESSION</varname> are different variables and that PHP handles them as such) </simpara> <simpara> If the <link linkend="ini.register-globals">register_globals</link> directive is set, then these variables will also be made available in the global scope of the script; i.e., separate from the <varname>$_SESSION</varname> and <varname>$HTTP_SESSION_VARS</varname> arrays. For related information, see the security chapter titled <link linkend="security.globals">Using Register Globals</link>. These individual globals are not superglobals. </simpara> </refsect1> <refsect1 role="changelog"> &reftitle.changelog; <para> <informaltable> <tgroup cols="2"> <thead> <row> <entry>&Version;</entry> <entry>&Description;</entry> </row> </thead> <tbody> <row> <entry>4.1.0</entry> <entry> Introduced <varname>$_SESSION</varname>. In previous the <varname>$HTTP_SESSION_VARS</varname> contained these information. </entry> </row> </tbody> </tgroup> </informaltable> </para> </refsect1> <refsect1 role="notes"> &reftitle.notes; ¬e.is-superglobal; </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t indent-tabs-mode:nil sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 -->