cvs: phpdoc-hk /language variables.xml
[email protected] ("Kevin Kee") Sat, 24 May 2003 13:18:32 -0000
| Newsgroups | php.doc.hk |
|---|---|
| Message-ID | <cvskevinkee1053782312@cvsserver> |
kevinkee Sat May 24 09:18:32 2003 EDT
Modified files:
/phpdoc-hk/language variables.xml
Log:
update part
kevinkee-20030524091832.txt
(text/plain, 55.9 KB)
Index: phpdoc-hk/language/variables.xml
diff -u phpdoc-hk/language/variables.xml:1.3 phpdoc-hk/language/variables.xml:1.4
--- phpdoc-hk/language/variables.xml:1.3 Wed Dec 12 15:50:37 2001
+++ phpdoc-hk/language/variables.xml Sat May 24 09:18:32 2003
@@ -1,933 +1,928 @@
-<?xml version="1.0" encoding="iso-8859-1"?>
- <chapter id="language.variables">
- <title>¦UÃþÅܼÆ</title>
-
- <sect1 id="language.variables.basics">
- <title>°ò¥»ª¾ÃÑ</title>
-
- <simpara>
-©Ò¦³ PHP ªºÅܼƫe±³£¦³¤@Ó "$" ²Å¸¹¡A «á±¸òµÛÅܼƪº¦W¦r¡C ª`·NÅܼƦWºÙ¬O¤À¤j¤p¼gªº¡C
- </simpara>
-
- <para>
- Variable names follow the same rules as other labels in PHP. A
- valid variable name starts with a letter or underscore, followed
- by any number of letters, numbers, or underscores. As a regular
- expression, it would be expressed thus:
- '[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*'
- </para>
-
- <note>
- <simpara>
- For our purposes here, a letter is a-z, A-Z, and the ASCII
- characters from 127 through 255 (0x7f-0xff).
- </simpara>
- </note>
-
- <para>
- <informalexample>
- <programlisting role="php">
-$var = "Bob";
-$Var = "Joe";
-echo "$var, $Var"; // outputs "Bob, Joe"
-
-$4site = 'not yet'; // invalid; starts with a number
-$_4site = 'not yet'; // valid; starts with an underscore
-$täyte = 'mansikka'; // valid; '?' is ASCII 228.
- </programlisting>
- </informalexample>
- </para>
-
- <para>
+<?xml version="1.0" encoding="big5"?>
+ <chapter id="language.variables">
+ <title>¦UÃþÅܼÆ</title>
+
+ <sect1 id="language.variables.basics">
+ <title>°ò¥»ª¾ÃÑ</title>
+
+ <simpara>
+ ©Ò¦³ PHP ªºÅܼƫe±³£¦³¤@Ó "$" ²Å¸¹¡A «á±¸òµÛÅܼƪº¦W¦r¡C ª`·NÅܼƦWºÙ¬O¤À¤j¤p¼gªº¡C
+ </simpara>
+
+ <para>
+ PHP ªºÅܼƦWºÙ©M¨ä¥L¼ÐÅÒ¦³µÛ¬Û¦Pªº³W«h¡C¤@Ó¦³®ÄªºÅܼƬO¥Ñ^¤å¦r¥À©Î©³½u¶}©l¡A¸òµÛ¬O¥ô·Nªøµuªº¦r¥À¡B¼Æ¦r©Î©³½u¡C«ö¥¿³W¹Bºâ¦¡¡A¥¦¥i¥Hªí¹F¬°¡G'[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*'
+ </para>
+
+ <note>
+ <simpara>
+ ª`¡G¦r¥À¬° a-z¡AA-Z¡A¦Ó ASCII ¦r²Å«h±q 127 ¦Ü 255¡q0x7f-0xff¡r¡C
+ </simpara>
+ </note>
+
+ <para>
+ <informalexample>
+ <programlisting role="php">
+$var = "Bob";
+$Var = "Joe";
+echo "$var, $Var"; // outputs "Bob, Joe"
+
+$4site = 'not yet'; // invalid; starts with a number
+$_4site = 'not yet'; // valid; starts with an underscore
+$täyte = 'mansikka'; // valid; '?' is ASCII 228.
+ </programlisting>
+ </informalexample>
+ </para>
+
+ <para>
¦b PHP3 ªº®É´Á¡A «ü©wµ¹Åܼƪº³£¬OÈ¡A ¨Ò¦p§â¤@¦æªí¹F¦¡«ü©wµ¹Åܼƪº¸Ü¡A ÅܼƩÒÀx¦sªº±N¬Oªí¹F¦¡pºâ¥X¨ÓªºÈ¡C ¥¦ªº¤Þ¥Ó·N¸q¬O¦pªG§A§â¬YÅܼƫü©wµ¹¥t¤@ÓÅܼƫá¡A §ïÅܨ䤤¤@Óªº¤º®e¨Ã¤£·|¼vÅT¥t¥~ªº¤@Ó¡C ·Q¶i¤@¨BÁA¸Ñ³oºØ«ü©wÅܼƤèªk¡A ½Ð¬Ý
-<link
- linkend="language.expressions">ªí¹F¦¡</link>¤@¸`¡C
- </para>
- <para>
- PHP4 «h´£¨Ñ¤F¥t¤@ºØ«ü©wÅܼƪº¤èªk:
+<link
+ linkend="language.expressions">ªí¹F¦¡</link>¤@¸`¡C
+ </para>
+ <para>
+ PHP4 «h´£¨Ñ¤F¥t¤@ºØ«ü©wÅܼƪº¤èªk:
<emphasis>ÅܼưѷÓ</emphasis>. ·N«ä¬O·sÅܼƥu¬O°Ñ·Ó¥»¨ÓªºÅܼƤ¤ªºÈ¡C (´«Ó»¡ªk¡A ·sªºÅܼƥu¬O¥»¨ÓªºÅܼƪº"§O¦W"¡A ¤]¥i»¡·sÅܼƬOÂÂÅܼƪº"«ü¼Ð") µL½×§ïÅÜþ¤@ÓÅܼơA §ï°Ê³£¦P®É¤Ï¬M¦b¥t¤@ÓÅܼƤ¤¡C ¥Ñ©óÂÂÅܼƪºÈ¨Ã¨S¦³³Q§Û¨ì·sÅܼƤ¤¡A ©Ò¥H³oºØ«ü©wÅܼƪº¤èªk°õ¦æ®É·|§Ö¤@ÂI¡A ¦ý¤]¥u¬O¤@ÂI¦Ó¤w¡C ¥u¦³¦b«ü©w¤j«¬ªº°}¦C¡Bª«¥ó©Î¬O¦b¤j¶qªº°j°é¾Þ§@¤¤¤~·|¬Ý¥X®Ä¯q¨Ó¡C
- </para>
- <para>
+ </para>
+ <para>
§@°Ñ·Ó«ü©wªº¤è¦¡¬O¦b³Q°Ñ·ÓªºÅܼÆ(ÂÂÅܼÆ)«e¥[¤WÓ(&) ²Å¸¹¡C ¹³¤U±ªº¥Ü¨Ò·|³sÄò¥´¥X¨â¥y¬Û¦Pªº¥y¤l:
-
- <informalexample>
- <programlisting role="php">
-<?php
-$foo = 'Bob'; // Assign the value 'Bob' to $foo
-$bar = &$foo; // Reference $foo via $bar.
-$bar = "My name is $bar"; // Alter $bar...
-echo $foo; // $foo is altered too.
-echo $bar;
-?>
- </programlisting>
- </informalexample>
- </para>
-
- <para>
+
+ <informalexample>
+ <programlisting role="php">
+<?php
+$foo = 'Bob'; // Assign the value 'Bob' to $foo
+$bar = &$foo; // Reference $foo via $bar.
+$bar = "My name is $bar"; // Alter $bar...
+echo $foo; // $foo is altered too.
+echo $bar;
+?>
+ </programlisting>
+ </informalexample>
+ </para>
+
+ <para>
¦³¤@ÂI«Ü«nªº¬O¥u¦³¯u¥¿ªºÅܼƤ~¥i¥H§@¬°ÂÂÅܼƳQ°Ñ·Ó¡C
- <informalexample>
- <programlisting role="php">
-<?php
-$foo = 25;
-$bar = &$foo; // This is a valid assignment.
-$bar = &(24 * 7); // Invalid; references an unnamed expression.
-
-function test() {
- return 25;
-}
-
-$bar = &test(); // Invalid.
-?>
- </programlisting>
- </informalexample>
- </para>
-
- </sect1>
-
- <sect1 id="language.variables.predefined">
- <title>¤w¹w³]¦nªºÅܼÆ</title>
-
- <simpara>
- PHP provides a large number of predefined variables to any script
- which it runs. Many of these variables, however, cannot be fully
- documented as they are dependent upon which server is running, the
- version and setup of the server, and other factors. Some of these
- variables will not be available when PHP is run on the
- command-line.
- </simpara>
-
- <simpara>
- Despite these factors, here is a list of predefined variables
- available under a stock installation of PHP 3 running as a module
- under a stock installation of <ulink
- url="&url.apache;">Apache</ulink> 1.3.6.
- </simpara>
-
- <simpara>
- For a list of all predefined variables (and lots of other useful
- information), please see (and use) <function>phpinfo</function>.
- </simpara>
-
- <note>
- <simpara>
- This list is neither exhaustive nor intended to be. It is simply
- a guideline as to what sorts of predefined variables you can
- expect to have access to in your script.
- </simpara>
- </note>
-
- <sect2 id="language.variables.predefined.apache">
- <title>Apache variables</title>
-
- <simpara>
- These variables are created by the <ulink
- url="&url.apache;">Apache</ulink> webserver. If you are running
- another webserver, there is no guarantee that it will provide the
- same variables; it may omit some, or provide others not listed
- here. That said, a large number of these variables are accounted
- for in the <ulink url="&url.cgispec;">CGI 1.1
- specification</ulink>, so you should be able to expect those.
- </simpara>
- <simpara>
- 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>GATEWAY_INTERFACE</term>
- <listitem>
- <simpara>
- What revision of the CGI specification the server is using;
- i.e. 'CGI/1.1'.
- </simpara>
- </listitem>
- </varlistentry>
-
- <varlistentry>
- <term>SERVER_NAME</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>SERVER_SOFTWARE</term>
- <listitem>
- <simpara>
- Server identification string, given in the headers when
- responding to requests.
- </simpara>
- </listitem>
- </varlistentry>
-
- <varlistentry>
- <term>SERVER_PROTOCOL</term>
- <listitem>
- <simpara>
- Name and revision of the information protocol via which the
- page was requested; i.e. 'HTTP/1.0';
- </simpara>
- </listitem>
- </varlistentry>
-
- <varlistentry>
- <term>REQUEST_METHOD</term>
- <listitem>
- <simpara>
- Which request method was used to access the page; i.e. 'GET',
- 'HEAD', 'POST', 'PUT'.
- </simpara>
- </listitem>
- </varlistentry>
-
- <varlistentry>
- <term>QUERY_STRING</term>
- <listitem>
- <simpara>
- The query string, if any, via which the page was accessed.
- </simpara>
- </listitem>
- </varlistentry>
-
- <varlistentry>
- <term>DOCUMENT_ROOT</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>HTTP_ACCEPT</term>
- <listitem>
- <simpara>
- Contents of the <literal>Accept:</literal> header from the
- current request, if there is one.
- </simpara>
- </listitem>
- </varlistentry>
-
- <varlistentry>
- <term>HTTP_ACCEPT_CHARSET</term>
- <listitem>
- <simpara>
- Contents of the <literal>Accept-Charset:</literal> header
- from the current request, if there is one. Example:
- 'iso-8859-1,*,utf-8'.
- </simpara>
- </listitem>
- </varlistentry>
-
- <varlistentry>
- <term>HTTP_ACCEPT_ENCODING</term>
- <listitem>
- <simpara>
- Contents of the <literal>Accept-Encoding:</literal> header
- from the current request, if there is one. Example: 'gzip'.
- </simpara>
- </listitem>
- </varlistentry>
-
- <varlistentry>
- <term>HTTP_ACCEPT_LANGUAGE</term>
- <listitem>
- <simpara>
- Contents of the <literal>Accept-Language:</literal> header
- from the current request, if there is one. Example: 'en'.
- </simpara>
- </listitem>
- </varlistentry>
-
- <varlistentry>
- <term>HTTP_CONNECTION</term>
- <listitem>
- <simpara>
- Contents of the <literal>Connection:</literal> header from
- the current request, if there is one. Example: 'Keep-Alive'.
- </simpara>
- </listitem>
- </varlistentry>
-
- <varlistentry>
- <term>HTTP_HOST</term>
- <listitem>
- <simpara>
- Contents of the <literal>Host:</literal> header from the
- current request, if there is one.
- </simpara>
- </listitem>
- </varlistentry>
-
- <varlistentry>
- <term>HTTP_REFERER</term>
- <listitem>
- <simpara>
- The address of the page (if any) which referred the browser
- to the current page. This is set by the user's browser; not
- all browsers will set this.
- </simpara>
- </listitem>
- </varlistentry>
-
- <varlistentry>
- <term>HTTP_USER_AGENT</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 browser software being used to view the current
- page; i.e. <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 functionality to the capabilities of the user's
- browser.
- </simpara>
- </listitem>
- </varlistentry>
-
- <varlistentry>
- <term>REMOTE_ADDR</term>
- <listitem>
- <simpara>
- The IP address from which the user is viewing the current
- page.
- </simpara>
- </listitem>
- </varlistentry>
-
- <varlistentry>
- <term>REMOTE_PORT</term>
- <listitem>
- <simpara>
- The port being used on the user's machine to communicate with
- the web server.
- </simpara>
- </listitem>
- </varlistentry>
-
- <varlistentry>
- <term>SCRIPT_FILENAME</term>
- <listitem>
- <simpara>
- The absolute pathname of the currently executing script.
- </simpara>
- </listitem>
- </varlistentry>
-
- <varlistentry>
- <term>SERVER_ADMIN</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>SERVER_PORT</term>
- <listitem>
- <simpara>
- The port on the server machine being used by the web server
- for communication. For default setups, this will be '80';
- using SSL, for instance, will change this to whatever your
- defined secure HTTP port is.
- </simpara>
- </listitem>
- </varlistentry>
-
- <varlistentry>
- <term>SERVER_SIGNATURE</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>PATH_TRANSLATED</term>
- <listitem>
- <simpara>
- Filesystem- (not document root-) based path to the current
- script, after the server has done any virtual-to-real
- mapping.
- </simpara>
- </listitem>
- </varlistentry>
-
- <varlistentry>
- <term>SCRIPT_NAME</term>
- <listitem>
- <simpara>
- Contains the current script's path. This is useful for pages
- which need to point to themselves.
- </simpara>
- </listitem>
- </varlistentry>
-
- <varlistentry>
- <term>REQUEST_URI</term>
- <listitem>
- <simpara>
- The URI which was given in order to access this page; for
- instance, '/index.html'.
- </simpara>
- </listitem>
- </varlistentry>
- </variablelist>
- </para>
-
- </sect2>
-
- <sect2 id="language.variables.predefined.environment">
- <title>Environment variables</title>
-
- <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>
-
- </sect2>
-
- <sect2 id="language.variables.predefined.php">
- <title>PHP variables</title>
-
- <simpara>
- These variables are created by PHP itself. The
- <varname>$HTTP_*_VARS</varname> variables are available only if
- the <link linkend="ini.track-vars">track_vars</link>
- configuration is turned on. When enabled, the variables are
- always set, even if they are empty arrays. This prevents
- a malicious user from spoofing these variables.
- </simpara>
-
- <note>
- <para>
- As of PHP 4.0.3, <link
- linkend="ini.track-vars">track_vars</link> is always turned on,
- regardless of the configuration file setting.
- </para>
- </note>
-
- <para>
- 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>$HTTP_*_VARS</varname> arrays. This feature should be
- used with care, and turned off if possible; while the
- <varname>$HTTP_*_VARS</varname> variables are safe, the bare
- global equivalents can be overwritten by user input, with
- possibly malicious intent. If you cannot turn off <link
- linkend="ini.register-globals">register_globals</link>, you must
- take whatever steps are necessary to ensure that the data you are
- using is safe.
- </para>
-
- <para>
- <variablelist>
- <varlistentry>
- <term>argv</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>argc</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>PHP_SELF</term>
- <listitem>
- <simpara>
- The filename of the currently executing script, relative to
- the document root. If PHP is running as a command-line
- processor, this variable is not available.
- </simpara>
- </listitem>
- </varlistentry>
-
- <varlistentry>
- <term>HTTP_COOKIE_VARS</term>
- <listitem>
- <simpara>
- An associative array of variables passed to the current
- script via HTTP cookies.
- </simpara>
- </listitem>
- </varlistentry>
-
- <varlistentry>
- <term>HTTP_GET_VARS</term>
- <listitem>
- <simpara>
- An associative array of variables passed to the current
- script via the HTTP GET method.
- </simpara>
- </listitem>
- </varlistentry>
-
- <varlistentry>
- <term>HTTP_POST_VARS</term>
- <listitem>
- <simpara>
- An associative array of variables passed to the current
- script via the HTTP POST method.
- </simpara>
- </listitem>
- </varlistentry>
-
- <varlistentry>
- <term>HTTP_POST_FILES</term>
- <listitem>
- <simpara>
- An associative array of variables containing information
- about files uploaded via the HTTP POST method. See <link
- linkend="features.file-upload.post-method">POST method
- uploads</link> for information on the contents of
- <varname>$HTTP_POST_FILES</varname>.
- </simpara>
- <para>
- <varname>$HTTP_POST_FILES</varname> is available only in PHP
- 4.0.0 and later.
- </para>
- </listitem>
- </varlistentry>
-
- <varlistentry>
- <term>HTTP_ENV_VARS</term>
- <listitem>
- <simpara>
- An associative array of variables passed to the current
- script via the parent environment.
- </simpara>
- </listitem>
- </varlistentry>
-
- <varlistentry>
- <term>HTTP_SERVER_VARS</term>
- <listitem>
- <simpara>
- An associative array of variables passed to the current
- script from the HTTP server. These variables are analogous to
- the Apache variables described above.
- </simpara>
- </listitem>
- </varlistentry>
- </variablelist>
- </para>
-
- </sect2>
-
- </sect1>
-
-
- <sect1 id="language.variables.scope">
- <title>Åܼƪº¦³®Ä½d³ò</title>
-
- <simpara>
+ <informalexample>
+ <programlisting role="php">
+<?php
+$foo = 25;
+$bar = &$foo; // This is a valid assignment.
+$bar = &(24 * 7); // Invalid; references an unnamed expression.
+
+function test() {
+ return 25;
+}
+
+$bar = &test(); // Invalid.
+?>
+ </programlisting>
+ </informalexample>
+ </para>
+
+ </sect1>
+
+ <sect1 id="language.variables.predefined">
+ <title>¤w¹w³]¦nªºÅܼÆ</title>
+
+ <simpara>
+ PHP provides a large number of predefined variables to any script
+ which it runs. Many of these variables, however, cannot be fully
+ documented as they are dependent upon which server is running, the
+ version and setup of the server, and other factors. Some of these
+ variables will not be available when PHP is run on the
+ command-line.
+ </simpara>
+
+ <simpara>
+ Despite these factors, here is a list of predefined variables
+ available under a stock installation of PHP 3 running as a module
+ under a stock installation of <ulink
+ url="&url.apache;">Apache</ulink> 1.3.6.
+ </simpara>
+
+ <simpara>
+ For a list of all predefined variables (and lots of other useful
+ information), please see (and use) <function>phpinfo</function>.
+ </simpara>
+
+ <note>
+ <simpara>
+ This list is neither exhaustive nor intended to be. It is simply
+ a guideline as to what sorts of predefined variables you can
+ expect to have access to in your script.
+ </simpara>
+ </note>
+
+ <sect2 id="language.variables.predefined.apache">
+ <title>Apache variables</title>
+
+ <simpara>
+ These variables are created by the <ulink
+ url="&url.apache;">Apache</ulink> webserver. If you are running
+ another webserver, there is no guarantee that it will provide the
+ same variables; it may omit some, or provide others not listed
+ here. That said, a large number of these variables are accounted
+ for in the <ulink url="&url.cgispec;">CGI 1.1
+ specification</ulink>, so you should be able to expect those.
+ </simpara>
+ <simpara>
+ 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>GATEWAY_INTERFACE</term>
+ <listitem>
+ <simpara>
+ What revision of the CGI specification the server is using;
+ i.e. 'CGI/1.1'.
+ </simpara>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term>SERVER_NAME</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>SERVER_SOFTWARE</term>
+ <listitem>
+ <simpara>
+ Server identification string, given in the headers when
+ responding to requests.
+ </simpara>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term>SERVER_PROTOCOL</term>
+ <listitem>
+ <simpara>
+ Name and revision of the information protocol via which the
+ page was requested; i.e. 'HTTP/1.0';
+ </simpara>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term>REQUEST_METHOD</term>
+ <listitem>
+ <simpara>
+ Which request method was used to access the page; i.e. 'GET',
+ 'HEAD', 'POST', 'PUT'.
+ </simpara>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term>QUERY_STRING</term>
+ <listitem>
+ <simpara>
+ The query string, if any, via which the page was accessed.
+ </simpara>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term>DOCUMENT_ROOT</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>HTTP_ACCEPT</term>
+ <listitem>
+ <simpara>
+ Contents of the <literal>Accept:</literal> header from the
+ current request, if there is one.
+ </simpara>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term>HTTP_ACCEPT_CHARSET</term>
+ <listitem>
+ <simpara>
+ Contents of the <literal>Accept-Charset:</literal> header
+ from the current request, if there is one. Example:
+ 'iso-8859-1,*,utf-8'.
+ </simpara>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term>HTTP_ACCEPT_ENCODING</term>
+ <listitem>
+ <simpara>
+ Contents of the <literal>Accept-Encoding:</literal> header
+ from the current request, if there is one. Example: 'gzip'.
+ </simpara>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term>HTTP_ACCEPT_LANGUAGE</term>
+ <listitem>
+ <simpara>
+ Contents of the <literal>Accept-Language:</literal> header
+ from the current request, if there is one. Example: 'en'.
+ </simpara>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term>HTTP_CONNECTION</term>
+ <listitem>
+ <simpara>
+ Contents of the <literal>Connection:</literal> header from
+ the current request, if there is one. Example: 'Keep-Alive'.
+ </simpara>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term>HTTP_HOST</term>
+ <listitem>
+ <simpara>
+ Contents of the <literal>Host:</literal> header from the
+ current request, if there is one.
+ </simpara>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term>HTTP_REFERER</term>
+ <listitem>
+ <simpara>
+ The address of the page (if any) which referred the browser
+ to the current page. This is set by the user's browser; not
+ all browsers will set this.
+ </simpara>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term>HTTP_USER_AGENT</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 browser software being used to view the current
+ page; i.e. <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 functionality to the capabilities of the user's
+ browser.
+ </simpara>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term>REMOTE_ADDR</term>
+ <listitem>
+ <simpara>
+ The IP address from which the user is viewing the current
+ page.
+ </simpara>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term>REMOTE_PORT</term>
+ <listitem>
+ <simpara>
+ The port being used on the user's machine to communicate with
+ the web server.
+ </simpara>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term>SCRIPT_FILENAME</term>
+ <listitem>
+ <simpara>
+ The absolute pathname of the currently executing script.
+ </simpara>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term>SERVER_ADMIN</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>SERVER_PORT</term>
+ <listitem>
+ <simpara>
+ The port on the server machine being used by the web server
+ for communication. For default setups, this will be '80';
+ using SSL, for instance, will change this to whatever your
+ defined secure HTTP port is.
+ </simpara>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term>SERVER_SIGNATURE</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>PATH_TRANSLATED</term>
+ <listitem>
+ <simpara>
+ Filesystem- (not document root-) based path to the current
+ script, after the server has done any virtual-to-real
+ mapping.
+ </simpara>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term>SCRIPT_NAME</term>
+ <listitem>
+ <simpara>
+ Contains the current script's path. This is useful for pages
+ which need to point to themselves.
+ </simpara>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term>REQUEST_URI</term>
+ <listitem>
+ <simpara>
+ The URI which was given in order to access this page; for
+ instance, '/index.html'.
+ </simpara>
+ </listitem>
+ </varlistentry>
+ </variablelist>
+ </para>
+
+ </sect2>
+
+ <sect2 id="language.variables.predefined.environment">
+ <title>Environment variables</title>
+
+ <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>
+
+ </sect2>
+
+ <sect2 id="language.variables.predefined.php">
+ <title>PHP variables</title>
+
+ <simpara>
+ These variables are created by PHP itself. The
+ <varname>$HTTP_*_VARS</varname> variables are available only if
+ the <link linkend="ini.track-vars">track_vars</link>
+ configuration is turned on. When enabled, the variables are
+ always set, even if they are empty arrays. This prevents
+ a malicious user from spoofing these variables.
+ </simpara>
+
+ <note>
+ <para>
+ As of PHP 4.0.3, <link
+ linkend="ini.track-vars">track_vars</link> is always turned on,
+ regardless of the configuration file setting.
+ </para>
+ </note>
+
+ <para>
+ 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>$HTTP_*_VARS</varname> arrays. This feature should be
+ used with care, and turned off if possible; while the
+ <varname>$HTTP_*_VARS</varname> variables are safe, the bare
+ global equivalents can be overwritten by user input, with
+ possibly malicious intent. If you cannot turn off <link
+ linkend="ini.register-globals">register_globals</link>, you must
+ take whatever steps are necessary to ensure that the data you are
+ using is safe.
+ </para>
+
+ <para>
+ <variablelist>
+ <varlistentry>
+ <term>argv</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>argc</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>PHP_SELF</term>
+ <listitem>
+ <simpara>
+ The filename of the currently executing script, relative to
+ the document root. If PHP is running as a command-line
+ processor, this variable is not available.
+ </simpara>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term>HTTP_COOKIE_VARS</term>
+ <listitem>
+ <simpara>
+ An associative array of variables passed to the current
+ script via HTTP cookies.
+ </simpara>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term>HTTP_GET_VARS</term>
+ <listitem>
+ <simpara>
+ An associative array of variables passed to the current
+ script via the HTTP GET method.
+ </simpara>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term>HTTP_POST_VARS</term>
+ <listitem>
+ <simpara>
+ An associative array of variables passed to the current
+ script via the HTTP POST method.
+ </simpara>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term>HTTP_POST_FILES</term>
+ <listitem>
+ <simpara>
+ An associative array of variables containing information
+ about files uploaded via the HTTP POST method. See <link
+ linkend="features.file-upload.post-method">POST method
+ uploads</link> for information on the contents of
+ <varname>$HTTP_POST_FILES</varname>.
+ </simpara>
+ <para>
+ <varname>$HTTP_POST_FILES</varname> is available only in PHP
+ 4.0.0 and later.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term>HTTP_ENV_VARS</term>
+ <listitem>
+ <simpara>
+ An associative array of variables passed to the current
+ script via the parent environment.
+ </simpara>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term>HTTP_SERVER_VARS</term>
+ <listitem>
+ <simpara>
+ An associative array of variables passed to the current
+ script from the HTTP server. These variables are analogous to
+ the Apache variables described above.
+ </simpara>
+ </listitem>
+ </varlistentry>
+ </variablelist>
+ </para>
+
+ </sect2>
+
+ </sect1>
+
+
+ <sect1 id="language.variables.scope">
+ <title>Åܼƪº¦³®Ä½d³ò</title>
+
+ <simpara>
Åܼƪº¦³®Ä½d³ò¬O«ü¥u¦³¦b¸Ó½d³ò¤§¤º¹q¸£¤~ª¾¹D¦³³o¼Ë¤@ÓÅܼƦs¦b¨Ã¥i¦s¨ú¨ä©ÒÀxªºÈ¡C ¤j«eÃD¬O©Ò¦³ªº PHP ÅܼƳ£¥u¦³³æ¤@ªº¦³®Ä½d³ò¡C ³o¦³®Ä½d³ò¦ù®i¨ì³Q include() ©M require() ªº¤å¥ó¤¤¡C ½Ð¬Ý¥Ü½d:
- </simpara>
- <informalexample>
- <programlisting role="php">
-$a = 1;
-include "b.inc";
- </programlisting>
- </informalexample>
- <simpara>
+ </simpara>
+ <informalexample>
+ <programlisting role="php">
+$a = 1;
+include "b.inc";
+ </programlisting>
+ </informalexample>
+ <simpara>
¦b b.inc ¤å¥ó¤¤ $a ÅܼƪºÈ¤]¬O 1 ¡C µM¦Ó¡A ¦b¨ç¼Æ¤¤ªºÅܼƨ䦳®Ä½d³ò«h§½¦b¨ç¼Æªº¥»Å餧¤¤¡C ¸õ¶i¨ç¼Æ®É¹q¸£¤£·|ª¾¹D¦b¨ç¼Æ³Q½Õ¥Î¤§«e¦³¤°»òÅܼƴ¿³Q©w¸q¡A ¦Ó©Ò¦³¦b¨ç¼Æ°õ¦æ®É¤~©w¸qªºÅܼƦb¸õ¥X¨ç¼Æ«á³£·|®ø¥¢¡C ¦p¤U¨Ò:
- </simpara>
-
- <informalexample>
- <programlisting role="php">
-$a = 1; /* global scope */
-
-Function Test () {
- echo $a; /* reference to local scope variable */
-}
-
-Test ();
- </programlisting>
- </informalexample>
-
- <simpara>
+ </simpara>
+
+ <informalexample>
+ <programlisting role="php">
+$a = 1; /* global scope */
+
+Function Test () {
+ echo $a; /* reference to local scope variable */
+}
+
+Test ();
+ </programlisting>
+ </informalexample>
+
+ <simpara>
¸Óµ{¦¡¨Ã¤£·|¥´¥X¥ô¦óȦ]¬°¦b echo $a ³o¤@«ü¥O¤¤¡A $a ªº¦³®Ä½d³ò¥u¬O¦b¨ç¼Æ¤§¤¤¡A¦ý¦b¨ç¼Æ·í¤¤¨Ã¨S¦³©w¸q $a ªºÈ¡F ¥t¤@¤è±¦b¨ç¼Æ¥~ªº $a ªº¦³®Ä½d³ò¨Ã¤£·|¦ù®i¨ì¨ç¼ÆùØ¥h¡C ¦p§A¬O C µ{¦¡ûªº¸Ü½Ð¯d·N³oºØ¦³®Ä½d³òªº©wªk©M C ¤£¤@¼Ë¡G ¦b C ·í¤¤©Ò¦³¥Dµ{¦¡¤¤ªºÅܼƳ£¬O¥þ°ìÅܼơC (°£«D¦b¨ç¼Æ¤¤¥t¥~«ü©w¡C) ¦]¬° C ªº¤è¦¡·|¤£¤p¤ß¦b¨ç¼Æ¤¤§ï°Ê¤F¥~³¡ÅܼơA ©Ò¥H¦b PHP ¤§¤¤¦³¦p·Q¦s¨ú¥~³¡Åܼƪº¸Ü´N¥²¶·«Å§i¤@Ó¥þ°ìÅܼơC ¥Ü½d¦p¤U:
- </simpara>
-
- <informalexample>
- <programlisting role="php">
-$a = 1;
-$b = 2;
-
-Function Sum () {
- global $a, $b;
-
- $b = $a + $b;
-}
-
-Sum ();
-echo $b;
- </programlisting>
- </informalexample>
-
- <simpara>
-¤W±ªº¨Ò¤l¤~·|¦L¥X "3"¡C ¦b¨ç¼Æ¤¤«Å§i $a¡B$b ¬°¥þ°ìÅܼƤ§«á´N¥i¥H¦s¨ú¦b¨ç¼Æ¥~±ªºÅܼơC ¤@Ó¨ç¼Æ¥i¥H«Å§i¥ô·N¦hÓ¥þ°ìÅܼơC
- </simpara>
-
- <simpara>
- ¥t¥~¤@Ó¦s¨ú¥~³¡Åܼƪº¤èªk¬O½Õ¥Î PHP ¤º¸mªº $GLOBALS[] °}¦C¡C ²{¦b§â«e±ªº¨Ò¤l§ï¼g¤@¤U: </simpara>
-
- <informalexample>
- <programlisting role="php">
-$a = 1;
-$b = 2;
-
-Function Sum () {
- $GLOBALS["b"] = $GLOBALS["a"] + $GLOBALS["b"];
-}
-
-Sum ();
-echo $b;
- </programlisting>
- </informalexample>
-
- <simpara>
-$GLOBALS °}¦C¬O¤@ÓÃöÁp¦r¯Á¤Þ¦¡°}¦C¡A Åܼƪº¦W¦r·|§@¬°¦b¦s¨ú¸Ó°}¦Cªº¯Á¤Þ¡C </simpara>
-
- <simpara>
-¥t¤@Ó«nªºÅܼƦ³®Ä½d³òªº·§©À¬O³Q«Å§i¦¨ static Ãþ«¬(ÀRºA)ªºÅܼơC ÀRºAÅܼƥu¦b¨ç¼Æ¤§¤¤¥X²{¡A ¤£¹L¦b¸õ¥X¨ç¼Æ¤§«á¥¦ÌªºÈ¨Ã¤£·|®ø¥¢¡C ¦Ò¼{¤U±ªº±¡ªp: </simpara>
-
- <informalexample>
- <programlisting role="php">
-Function Test () {
- $a = 0;
- echo $a;
- $a++;
-}
- </programlisting>
- </informalexample>
-
- <simpara>
+ </simpara>
+
+ <informalexample>
+ <programlisting role="php">
+$a = 1;
+$b = 2;
+
+Function Sum () {
+ global $a, $b;
+
+ $b = $a + $b;
+}
+
+Sum ();
+echo $b;
+ </programlisting>
+ </informalexample>
+
+ <simpara>
+¤W±ªº¨Ò¤l¤~·|¦L¥X "3"¡C ¦b¨ç¼Æ¤¤«Å§i $a¡B$b ¬°¥þ°ìÅܼƤ§«á´N¥i¥H¦s¨ú¦b¨ç¼Æ¥~±ªºÅܼơC ¤@Ó¨ç¼Æ¥i¥H«Å§i¥ô·N¦hÓ¥þ°ìÅܼơC
+ </simpara>
+
+ <simpara>
+ ¥t¥~¤@Ó¦s¨ú¥~³¡Åܼƪº¤èªk¬O½Õ¥Î PHP ¤º¸mªº $GLOBALS[] °}¦C¡C ²{¦b§â«e±ªº¨Ò¤l§ï¼g¤@¤U: </simpara>
+
+ <informalexample>
+ <programlisting role="php">
+$a = 1;
+$b = 2;
+
+Function Sum () {
+ $GLOBALS["b"] = $GLOBALS["a"] + $GLOBALS["b"];
+}
+
+Sum ();
+echo $b;
+ </programlisting>
+ </informalexample>
+
+ <simpara>
+$GLOBALS °}¦C¬O¤@ÓÃöÁp¦r¯Á¤Þ¦¡°}¦C¡A Åܼƪº¦W¦r·|§@¬°¦b¦s¨ú¸Ó°}¦Cªº¯Á¤Þ¡C </simpara>
+
+ <simpara>
+¥t¤@Ó«nªºÅܼƦ³®Ä½d³òªº·§©À¬O³Q«Å§i¦¨ static Ãþ«¬(ÀRºA)ªºÅܼơC ÀRºAÅܼƥu¦b¨ç¼Æ¤§¤¤¥X²{¡A ¤£¹L¦b¸õ¥X¨ç¼Æ¤§«á¥¦ÌªºÈ¨Ã¤£·|®ø¥¢¡C ¦Ò¼{¤U±ªº±¡ªp: </simpara>
+
+ <informalexample>
+ <programlisting role="php">
+Function Test () {
+ $a = 0;
+ echo $a;
+ $a++;
+}
+ </programlisting>
+ </informalexample>
+
+ <simpara>
¤W±ªº¨ç¼Æ®Ú¥»°_¤£¤F§@¥Î¦]¬°¨C¦¸¶i¤J¨ç¼Æ«á $a ³£·|³Q«·s«ü©w¬° "0"¡E $a++ ³o¤@¥y«ü¥O¤@ÂI¥Î¤]¨S¦³¦]¬°¨C¦¸¸õ¥X¨ç¼Æ®É $a ´N®ø¥¢¤F¡C ¬°¤F¥O¨ç¼Æ¦¨¬°¦³¥Îªºp¼Æ¾¹¡A ¥²¶·§â $a «Å§i¬° static:
- </simpara>
-
- <informalexample>
- <programlisting role="php">
-Function Test () {
- static $a = 0;
- echo $a;
- $a++;
-}
- </programlisting>
- </informalexample>
-
- <simpara>
-²{¦b test() ¨ç¼Æ·|¦L¥X $a ªºÈ¨Ã§âÈ¥¦¥[ 1¡C </simpara>
-
- <simpara>
+ </simpara>
+
+ <informalexample>
+ <programlisting role="php">
+Function Test () {
+ static $a = 0;
+ echo $a;
+ $a++;
+}
+ </programlisting>
+ </informalexample>
+
+ <simpara>
+²{¦b test() ¨ç¼Æ·|¦L¥X $a ªºÈ¨Ã§âÈ¥¦¥[ 1¡C </simpara>
+
+ <simpara>
ÀRºAÅܼƤ]¥i¥H¥Î¨Ó½s¼g»¼Âk¨ç¼Æ recursive function¡C ³oÃþ¨ç¼Æ·|½Õ¥Î¦Û¤v¡C ¼g³oÃþ¨ç¼Æ®ÉnÁ×§KµL´`Àô¦a½Õ¥Î¡C §A¤@©wn¦³¿ìªk§â»¼Âk²×¤î¡C ¤U¨Ò¥Î $count ÅܼƨÓp¼Æ¡A ·í¥¦¼Æ¨ì 10 ªº®ÉÔ´N¸õ¥X¨ç¼Æ:
- </simpara>
-
- <informalexample>
- <programlisting role="php">
-Function Test () {
- static $count = 0;
-
- $count++;
- echo $count;
- if ($count < 10) {
- Test ();
- }
- $count--;
-}
- </programlisting>
- </informalexample>
-
- </sect1>
-
- <sect1 id="language.variables.variable">
- <title>¥ÎÅܼƨӽեÎÅܼÆ</title>
-
- <simpara>
- ¦³ªº±¡ÒX¤U¡A ¥Î¤@ÓÅܼƨÓÀx¦s¥t¤@ÓÅܼƪº¦W¦r·|¥O½sµ{§ó¤è«K¡C ¦]¬°³o¼Ë¤@¨Ó¥i¥H°ÊºA¦a½Õ¥ÎÅܼơC ¤@Ó¥¿±`ªºÅܼƫŧi¬O³o¼Ëªº:
- </simpara>
-
- <informalexample>
- <programlisting role="php">
-$a = "hello";
- </programlisting>
- </informalexample>
-
- <simpara>
+ </simpara>
+
+ <informalexample>
+ <programlisting role="php">
+Function Test () {
+ static $count = 0;
+
+ $count++;
+ echo $count;
+ if ($count < 10) {
+ Test ();
+ }
+ $count--;
+}
+ </programlisting>
+ </informalexample>
+
+ </sect1>
+
+ <sect1 id="language.variables.variable">
+ <title>¥ÎÅܼƨӽեÎÅܼÆ</title>
+
+ <simpara>
+ ¦³ªº±¡ÒX¤U¡A ¥Î¤@ÓÅܼƨÓÀx¦s¥t¤@ÓÅܼƪº¦W¦r·|¥O½sµ{§ó¤è«K¡C ¦]¬°³o¼Ë¤@¨Ó¥i¥H°ÊºA¦a½Õ¥ÎÅܼơC ¤@Ó¥¿±`ªºÅܼƫŧi¬O³o¼Ëªº:
+ </simpara>
+
+ <informalexample>
+ <programlisting role="php">
+$a = "hello";
+ </programlisting>
+ </informalexample>
+
+ <simpara>
¦Ó¤@ÓÅܼƪºÅܼƫh§â¦s¦b¨ä¤¤ªºÈ·í°µ¬O¥t¤@ÓÅܼƪº¦W¦r¡C ¦b¤W¨Òªº $a ¤§«e¥Î¨â '$' ¸¹ªº¸Ü¡A hello´N·|³Q·í¦¨¬O¥t¤@ÓÅܼƪº¦W¦r¡G
- </simpara>
-
- <informalexample>
- <programlisting role="php">
-$$a = "world";
- </programlisting>
- </informalexample>
-
- <simpara>
+ </simpara>
+
+ <informalexample>
+ <programlisting role="php">
+$$a = "world";
+ </programlisting>
+ </informalexample>
+
+ <simpara>
¨ì³oùج°¤î¡A ¤@¦@«Å§i¤F¨âÓÅܼơA ¤@Ó¬O $a¡A ¥t¤@Ó¬O $hello¡C ¬O¥H¤U±ªº«ü¥O¡G
- </simpara>
-
- <informalexample>
- <programlisting role="php">
-echo "$a ${$a}";
- </programlisting>
- </informalexample>
-
- <simpara>
+ </simpara>
+
+ <informalexample>
+ <programlisting role="php">
+echo "$a ${$a}";
+ </programlisting>
+ </informalexample>
+
+ <simpara>
©Ò¦L¥X¨Óªºµ²ªG©M³o¤@¥y
- </simpara>
-
- <informalexample>
- <programlisting>
-echo "$a $hello";
- </programlisting>
- </informalexample>
-
- <simpara>
+ </simpara>
+
+ <informalexample>
+ <programlisting>
+echo "$a $hello";
+ </programlisting>
+ </informalexample>
+
+ <simpara>
ªºµ²ªG¬O¤@¼Ëªº¡G hello world.
- </simpara>
-
- <simpara>
+ </simpara>
+
+ <simpara>
¦b¥ÎÅܼƪºÅܼƳoªk¤l¨Ó¦s¨ú°}¦Cªº¸Ü¡A n¯d·N $$a[1] ¦³¨âÓ·N«ä¡G ¥i¥H¬O«ü $a[1] ¬O¤@ÓÅܼƪº¦WºÙ¡B¤]¥i¥H«ü $$a ¬O¤@ÓÅܼƦWºÙ¦Ó [1] ¬O¸ÓÅܼƤ¤¤¸¯Àªº¯Á¤Þ ¸¹¡C ¬°¤F©ú½T§i¶D¹q¸£§Aªº·N¹Ï¡A ¥Î ${$a[1]} ¥Nªí²Ä¤@Ó·N«ä¡B ${$a}[1] ¥Nªí²Ä¤GÓ¡C
- </simpara>
-
- </sect1>
-
- <sect1 id="language.variables.external">
- <title>¥~³¡ÅܼÆ</title>
-
- <sect2 id="language.variables.external.form">
+ </simpara>
+
+ </sect1>
+
+ <sect1 id="language.variables.external">
+ <title>¥~³¡ÅܼÆ</title>
+
+ <sect2 id="language.variables.external.form">
<title>HTML ªí (GET and POST)
-</title>
-
- <simpara>
+</title>
+
+ <simpara>
·íªí³æ³Q´£¥æµ¹ PHP µ{¦¡®É¡A ©Ò¦³¦bªí³æ¤¤ªºÅܼƳ£¦Û°Êµ¹¤À¹j¶}¨Ã¶Çµ¹µ{¦¡¡C °²¦p¦³¤@±i¦p¤U¨Òªºªí³æ:
-If the <link linkend="ini.track-vars">track_vars</link>
- configuration option is turned on, then these variables will be
- located in the associative arrays
- <varname>$HTTP_POST_VARS</varname>,
- <varname>$HTTP_GET_VARS</varname>, and/or
- <varname>$HTTP_POST_FILES</varname>, according to the
- source of the variable in question.
- </simpara>
-
- <para>
- For more information on these variables, please read <link
- linkend="language.variables.predefined">Predefined
- variables</link>.
- </para>
-
- <para>
- <example>
- <title>²³æªºªí³æÅܼÆ</title>
- <programlisting role="php">
-<form action="foo.php" method="post">
- Name: <input type="text" name="username"><br>
- <input type="submit">
-</form>
- </programlisting>
- </example>
- </para>
-
- <para>
+If the <link linkend="ini.track-vars">track_vars</link>
+ configuration option is turned on, then these variables will be
+ located in the associative arrays
+ <varname>$HTTP_POST_VARS</varname>,
+ <varname>$HTTP_GET_VARS</varname>, and/or
+ <varname>$HTTP_POST_FILES</varname>, according to the
+ source of the variable in question.
+ </simpara>
+
+ <para>
+ For more information on these variables, please read <link
+ linkend="language.variables.predefined">Predefined
+ variables</link>.
+ </para>
+
+ <para>
+ <example>
+ <title>²³æªºªí³æÅܼÆ</title>
+ <programlisting role="php">
+<form action="foo.php" method="post">
+ Name: <input type="text" name="username"><br>
+ <input type="submit">
+</form>
+ </programlisting>
+ </example>
+ </para>
+
+ <para>
·í«ö¤U SUBMIT «á¡A PHP ·|¦Û°Ê«ü©wÅÜ¼Æ $name ¡A ¨ä¤¤·|Àx¦sªí³æ¤¤ Name: ³o¤@Äæ©Ò§tªºÈ¡C
PHP ¦³Ó¥s track_vars ªº¥i½Õ¶µ¡A ¦b¶}ªºª¬ºA¤U¥Î POST ©Î GET ¤èªk´£¥æªºªí³æÄæ¦ì¥i¥H¦b¬ÛÀ³ªº $HTTP_POST_VARS ©Î $HTTP_GET_VARS °}¦C¤¤§ä¨ì¡C n¥´¶}³oÓ¥\¯à¥i¥H§ï track_vars ³oӰѼƩΨϥΠ<?php_track_vars?> «ü¥O¡C
- </para>
-
- <simpara>
+ </para>
+
+ <simpara>
PHP ÁÙ¥i¥H¤À¸Ñªí³æ¤¤°}¦C«¬ºAªºÅܼơC §A¥i§Q¥Î³o¤@¯S©Ê§â¬ÛÃöªºÅܼƤÀ²Õ©ÎªÌ¬OÀx¦s®e³\¦h¶µ¿ï¾Üªºªí³æÄæ¦ì:
- </simpara>
-
- <para>
- <example>
+ </simpara>
+
+ <para>
+ <example>
<title>½ÆÂø¤@¨Çªºªí³æ
-</title>
- <programlisting role="php">
-<form action="array.php" method="post">
- Name: <input type="text" name="personal[name]"><br>
- Email: <input type="text" name="personal[email]"><br>
- Beer: <br>
- <select multiple name="beer[]">
- <option value="warthog">Warthog
- <option value="guinness">Guinness
- <option value="stuttgarter">Stuttgarter Schwabenbräu
- </select>
- <input type="submit">
-</form>
- </programlisting>
- </example>
- </para>
-
- <para>
- In PHP 3, the array form variable usage is limited to
- single-dimensional arrays. In PHP 4, no such restriction applies.
- </para>
-
- <sect3 id="language.variables.external.form.submit">
- <title>¥Î IMAGE SUBMIT ªºÅܼƦW</title>
-
- <simpara>
- ´£¥æªí³æ®É¡A ¥i¥H¤£¥Î¼Ð·Çªº«ö¶s¦Ó¥Î¹Ï®×¥N´À¡C ¥yªk¦p¤U:</simpara>
-
- <informalexample>
- <programlisting role="php">
-<input type=image src="image.gif" name="sub">
- </programlisting>
- </informalexample>
-
- <simpara>
+</title>
+ <programlisting role="php">
+<form action="array.php" method="post">
+ Name: <input type="text" name="personal[name]"><br>
+ Email: <input type="text" name="personal[email]"><br>
+ Beer: <br>
+ <select multiple name="beer[]">
+ <option value="warthog">Warthog
+ <option value="guinness">Guinness
+ <option value="stuttgarter">Stuttgarter Schwabenbräu
+ </select>
+ <input type="submit">
+</form>
+ </programlisting>
+ </example>
+ </para>
+
+ <para>
+ In PHP 3, the array form variable usage is limited to
+ single-dimensional arrays. In PHP 4, no such restriction applies.
+ </para>
+
+ <sect3 id="language.variables.external.form.submit">
+ <title>¥Î IMAGE SUBMIT ªºÅܼƦW</title>
+
+ <simpara>
+ ´£¥æªí³æ®É¡A ¥i¥H¤£¥Î¼Ð·Çªº«ö¶s¦Ó¥Î¹Ï®×¥N´À¡C ¥yªk¦p¤U:</simpara>
+
+ <informalexample>
+ <programlisting role="php">
+<input type=image src="image.gif" name="sub">
+ </programlisting>
+ </informalexample>
+
+ <simpara>
·í¨Ï¥ÎªÌ«ö¦b¸Ó¹Ï®×¤W®É¡A ¶Ç¥hµ¹¦øªA¾¹ªºªí³æ¸ê®Æ·|¦³¨âÓ·sªºÈ sub_x ©M sub_y¡A ¤À§O¬O¨Ï¥ÎªÌ«ö¦b¹Ï®×¤Wªº®y¼Ð¡C ªí³æ¦Ñ¤âÌ¥i¯à·|ª¾¹D¨ä¹ê°eµ¹¦øªA¾¹ªºªºÄæ¦ì¬O sub.x ©M sub.y¡A ¤£¹L PHP ¦Û°Ê§â¥y¸¹Åܦ¨¤F©³½u¸¹¡C
- </simpara>
- </sect3>
-
- </sect2>
-
- <sect2 id="language.variables.external.cookies">
+ </simpara>
+ </sect3>
+
+ </sect2>
+
+ <sect2 id="language.variables.external.cookies">
<title>HTTP cookies (²¢»æ ?)
-</title>
-
- <simpara>
-PHP ¤ä«ù¥Ñ <ulink
+</title>
+
+ <simpara>
+PHP ¤ä«ù¥Ñ <ulink
url="&spec.cookies;">Netscape's Spec</ulink>©Ò©w¸qªº HTTP cookies¡C Cookies ¬O§â¸ê®Æ¦s¨ì«È¤á¾÷¤Wªº¤@ºØ¤èªk¡C ³o¨Ç¸ê®Æ¥i¥H¥Î¨Ó¿ë§O¥Î¤áªº¨¥÷¡C n³]©w COOKIES ¥i¥Î SetCookie() ¨ç¼Æ¡C ¦]¬° COOKIES ¬O HTTP HEADER ¼ÐÀYªº¤@³¡¥÷©Ò¥H°e¥X COOKIE ªº©R¥O¥²¶·§â¶±¤º®e¿é¥Xµ¹ÂsÄý¾¹¤§«e°õ¦æ¡C ³o¨î©M¨Ï¥Î Header() ¨ç¼Æªº¨î¬O¤@¼Ëªº¡C ¦Ü©ó±qÂsÄý¾¹°e¦^¨Óªº COOKIES «h¹³ GET¡B POST ¤èªk¤@¼Ë·|¦Û°Ê¦s¦bÅܼÆùØ¡C
-</simpara>
-
- <simpara>
+</simpara>
+
+ <simpara>
¦p·Q¥Î¤@Ó COOKIE ¦s¦h¹L¤@ÓÈ¡A ¥u»Ý¦b COOKIE ¦W¦r«á¥[¤W []¡C ¥Ü½d:
- </simpara>
-
- <informalexample>
- <programlisting role="php">
-SetCookie ("MyCookie[]", "Testing", time()+3600);
- </programlisting>
- </informalexample>
-
- <simpara>
+ </simpara>
+
+ <informalexample>
+ <programlisting role="php">
+SetCookie ("MyCookie[]", "Testing", time()+3600);
+ </programlisting>
+ </informalexample>
+
+ <simpara>
ª`·N°£«D¸ô®|©Îºô°ì¦W¦r¤£¤@¼Ë¡A ¤£µM§A°e¥Xªº COOKIE ·|¨ú¥N¤§«e¦P¦Wªº COOKIE¡C ¦]¦¹¦b½s¼gÁʪ«Äxµ{¦¡®É¦³®Én¥[¤@Óp¼Æ¾¹¡C ´N¹³³o¼Ë¡G
- </simpara>
-
- <example>
- <title>SetCookie ¥Ü½d</title>
- <programlisting role="php">
-$Count++;
-SetCookie ("Count", $Count, time()+3600);
-SetCookie ("Cart[$Count]", $item, time()+3600);
- </programlisting>
- </example>
-
- </sect2>
-
- <sect2 id="language.variables.external.environment">
- <title>§@·~Àô¹ÒÅܼÆ</title>
-
- <para>
+ </simpara>
+
+ <example>
+ <title>SetCookie ¥Ü½d</title>
+ <programlisting role="php">
+$Count++;
+SetCookie ("Count", $Count, time()+3600);
+SetCookie ("Cart[$Count]", $item, time()+3600);
+ </programlisting>
+ </example>
+
+ </sect2>
+
+ <sect2 id="language.variables.external.environment">
+ <title>§@·~Àô¹ÒÅܼÆ</title>
+
+ <para>
PHP ·|¦Û°Ê§âÃö©ó§@·~Àô¹Òªº¸ê®Æ¾ã²z¦¨¤@¯ëªºÅܼƨѵ{¦¡¨ú¥Î¡C
- <informalexample>
- <programlisting role="php">
-echo $HOME; /* Shows the HOME environment variable, if set. */
- </programlisting>
- </informalexample>
- </para>
-
- <para>
+ <informalexample>
+ <programlisting role="php">
+echo $HOME; /* Shows the HOME environment variable, if set. */
+ </programlisting>
+ </informalexample>
+ </para>
+
+ <para>
¤p¤ß°_¨£¡A Ū¨úÀô¹ÒÅܼƮɳ̦n¥Î <function>getenv</function>¨ç¼Æ¡A ³o¬O¦]¬° PHP ¤@¼Ë¬°ªí³æ¡BCOOKIE µ¥µ¥¦Û°Ê©w¸qÅܼơA ¦³®ÉÔ·|¤£¤p¤ß¥Î¤F¬Û¦Pªº¦W¦r¡A ¨ì®É§AŪ¨úªº¥i¯à¨Ã¤£¬O¯u¥¿ªºÀô¹ÒÅܼơC §ï°ÊÀô¹ÒÅܼƫh¥i¥Î
<function>putenv</function>¨ç¼Æ¡C
- </para>
- </sect2>
-
- <sect2 id="language.variables.external.dot-in-names">
- <title>±a '.' ¸¹ªºÅܼÆ</title>
-
- <para>
+ </para>
+ </sect2>
+
+ <sect2 id="language.variables.external.dot-in-names">
+ <title>±a '.' ¸¹ªºÅܼÆ</title>
+
+ <para>
°ò¥»¤W PHP ¤£·|¾Õ§ïÅܼƪº¦W¦r¡A ¦ý¥Ñ©ó PHP ¤§¤¤ '.' ¸¹¦³¯S§Oªº·N«ä(¦ê±µ¤å¥y)¤£¥i¥H§@¬°ÅܼƦW¦r¡A ©Ò¥H±a '.' ¸¹ªºÅܼƦWºÙ¤¤ªº '.' ·|Åܦ¨ '_':
- <programlisting role="php">
-$varname.ext; /* invalid variable name */
- </programlisting>
+ <programlisting role="php">
+$varname.ext; /* invalid variable name */
+ </programlisting>
¤W±½d¨Ò¤¤ PHP ·|²z¸Ñ¬°¤@ÓÅÜ¼Æ $varname¡A «á±¸òµÛ¦A¦ê±µ¥t¤@ÓÅÜ¼Æ $ext¡C ÅãµM PHP ²z¸Ñ¿ù¤F¥»¨Óªº¥Î·N¡C
- </para>
-
- </sect2>
-
- <sect2 id="language.variables.determining-type-of">
+ </para>
+
+ </sect2>
+
+ <sect2 id="language.variables.determining-type-of">
<title>¬d¸ßÅܼƪº§ÎºA
-</title>
-
- <para>
+</title>
+
+ <para>
¥Ñ©ó PHP ·|¨Ì¤º®e¦Û°Ê³]©wÅܼƪº§ÎºA¡A ¦³®ÉÔ«ÜÃø¤@²´¬Ý¥X¤@ÓÅܼƨ쩳¨ú¥Î¤F¨º¤@ºØ§ÎºA¡C ¬°¤FÅý¥ÎªÌ¨ú±o³oÃþ¸ê°T¡A PHP ¦³¦n¦hÓ¨ç¼Æ¥i¥H½Õ¥Î¡G
- <function>gettype</function>, <function>is_long</function>,
- <function>is_double</function>, <function>is_string</function>,
- <function>is_array</function>,©M
- <function>is_object</function>.
- </para>
- </sect2>
-
- </sect1>
-
- </chapter>
-
- <!-- 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:
- -->
+ <function>gettype</function>, <function>is_long</function>,
+ <function>is_double</function>, <function>is_string</function>,
+ <function>is_array</function>,©M
+ <function>is_object</function>.
+ </para>
+ </sect2>
+
+ </sect1>
+
+ </chapter>
+
+ <!-- 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:
+ -->