cvs: phpdoc-zh /language variables.xml

From: Date: Fri, 06 Sep 2002 09:47:25 +0000
Subject: cvs: phpdoc-zh /language variables.xml
Groups: php.doc.zh 
Request: Send a blank email to doc-zh+get-479@lists.php.net to get a copy of this message
verdana Fri Sep 6 05:47:25 2002 EDT Modified files: /phpdoc-zh/language variables.xml Log: no message

Index: phpdoc-zh/language/variables.xml diff -u phpdoc-zh/language/variables.xml:1.1 phpdoc-zh/language/variables.xml:1.2 --- phpdoc-zh/language/variables.xml:1.1 Thu Aug 15 22:55:35 2002 +++ phpdoc-zh/language/variables.xml Fri Sep 6 05:47:25 2002 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.1 $ --> +<!-- $Revision: 1.2 $ --> <!-- $Author: verdana $ --> <!-- EN-Revision: 1.53 Maintainer: verdana Status: --> <chapter id="language.variables"> @@ -124,39 +124,28 @@ »·¾³±äÁ¿ HOME µÄÖµ¡£ </simpara> <simpara> - For related information on this change, read the configuration entry for - <link linkend="ini.register-globals">register_globals</link>, the security - chapter on <link linkend="security.registerglobals">Using Register Globals - </link>, as well as the PHP <ulink url="&url.php.release4.1.0;">4.1.0 - </ulink> and <ulink url="&url.php.release4.2.0;">4.2.0</ulink> Release - Announcements. + ¸ü¶àÏà¹ØÐÅÏ¢£¬ÇëÔĶÁÅäÖÃÏîÄ¿ <link linkend="ini.register-globals">register_globals</link>£¬ + Óйذ²È«ÐÔµÄÒ»Õ <link linkend="security.registerglobals">ʹÓà Register Globals</link>£¬ + ÒÔ¼° PHP <ulink url="&url.php.release4.1.0;">4.1.0</ulink> ºÍ + <ulink url="&url.php.release4.2.0;">4.2.0</ulink> µÄ·¢ÐÐͨ¸æ. </simpara> <simpara> - Using the available PHP Reserved Predefined Variables, like the - <link linkend="language.variables.superglobals">superglobal arrays</link>, - is preferred. + ÇëÓÅÏÈʹÓÿÉÓÃµÄ PHP Ô¤¶¨Òå±äÁ¿£¬Èç <link linkend="language.variables.superglobals">³¬¼¶È«¾ÖÊý×é</link>¡£ </simpara> </warning> <simpara> - From version 4.1.0 onward, PHP provides an additional set of predefined arrays - containing variables from the web server (if applicable), the - environment, and user input. These new arrays are rather special - in that they are automatically global--i.e., automatically - available in every scope. For this reason, they are often known as - 'autoglobals' or 'superglobals'. (There is no mechanism in PHP for - user-defined superglobals.) The superglobals are listed below; - however, for a listing of their contents and further discussion on - PHP predefined variables and their natures, please see the section - <link linkend="reserved.variables">Reserved Predefined Variables</link>. - Also, you'll notice how the older predefined variables - (<varname>$HTTP_*_VARS</varname>) still exist. + ´Ó PHP 4.1.0 ¿ªÊ¼£¬PHP ÌṩÁËÒ»Ì׸½¼ÓµÄÔ¤¶¨Êý×飬ÕâЩÊý×é±äÁ¿°üº¬ÁËÀ´×Ô Web ·þÎñÆ÷£¨Èç¹û¿ÉÓã©£¬ + ÔËÐл·¾³£¬ºÍÓû§ÊäÈëµÄÊý¾Ý¡£ÕâЩÊý×é·Ç³£Ìرð£¬ËýÃÇÔÚÈ«¾Ö·¶Î§ÄÚ×Ô¶¯ÉúЧ£¬ÀýÈ磬ÔÚÈκη¶Î§ÄÚ×Ô¶¯ÉúЧ¡£ + Ϊ´Ë£¬ËýÃdz£ÒòÊÇ "autoglobals" »òÕß "superglobals" ¶øÎÅÃû¡££¨PHP ÖÐÉÐÇÒûÓÐÒ»ÖÖ¿ÉʹÓû§ + ×Ô¶¨Ò峬¼¶È«¾Ö±äÁ¿µÄ»úÖÆ£©³¬¼¶È«¾Ö±äÁ¿ÂÞÁÐÓÚÏÂÎÄÖУ»µ«ÊÇΪÁ˵õ½ËýÃǵÄÄÚÈݺ͹ØÓÚ PHP Ô¤¶¨ + Òå±äÁ¿µÄ½øÒ»²½µÄÌÖÂÛÒÔ¼°ËýÃǵı¾ÖÊ£¬Çë²ÎÔÄ <link linkend="reserved.variables">Ô¤¶¨Òå±äÁ¿</link>¡£ + ¶øÇÒ£¬ÄãÒ²½«×¢Òâµ½¾ÉµÄµØÔ¤¶¨ÒåÊý×飨<varname>$HTTP_*_VARS</varname>£©ÈԾɴæÔÚ¡£ </simpara> <para> - If certain variables in <link - linkend="ini.variables-order">variables_order</link> are not set, their - appropriate PHP predefined arrays are also left empty. + Èç¹ûijЩ <link linkend="ini.variables-order">variables_order</link> ÖеıäÁ¿Ã»ÓÐÉ趨£¬ËýÃÇµÄ + ¶ÔÓ¦µÄ PHP Ô¤¶¨ÒåÊý×éÒ²Êǿյġ£ </para> <variablelist id="language.variables.superglobals"> @@ -165,10 +154,8 @@ <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. - <varname>$GLOBALS</varname> has existed since PHP 3. + °üº¬Ò»¸öÒýÓÃÖ¸Ïòÿ¸öµ±Ç°½Å±¾µÄÈ«¾Ö·¶Î§ÄÚÓÐЧµÄ±äÁ¿¡£¸ÃÊý×éµÄ¼ü±êΪȫ¾Ö±äÁ¿µÄ + Ãû³Æ¡£´Ó PHP 3 ¿ªÊ¼´æÔÚ <varname>$GLOBALS</varname> Êý×é¡£ </simpara> </listitem> </varlistentry> @@ -176,10 +163,8 @@ <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). + ±äÁ¿ÓÉ Web ·þÎñÆ÷É趨»òÕßÖ±½ÓÓ뵱ǰ½Å±¾µÄÖ´Ðл·¾³Ïà¹ØÁª¡£ÀàËÆÓÚ¾ÉÊý×é <varname>$HTTP_SERVER_VARS</varname> + Êý×飨ÒÀÈ»ÓÐЧ£¬µ«·´¶ÔʹÓã©¡£ </simpara> </listitem> </varlistentry> @@ -187,9 +172,8 @@ <term><link linkend="reserved.variables.get">$_GET</link></term> <listitem> <simpara> - Variables provided to the script via HTTP GET. Analogous to the - old <varname>$HTTP_GET_VARS</varname> array (which is still - available, but deprecated). + ¾­ÓÉ HTTP GET ·½·¨Ìá½»ÖÁ½Å±¾µÄ±äÁ¿¡£ÀàËÆÓÚ¾ÉÊý×é <varname>$HTTP_GET_VARS</varname> + Êý×飨ÒÀÈ»ÓÐЧ£¬µ«·´¶ÔʹÓã©¡£ </simpara> </listitem> </varlistentry> @@ -197,9 +181,8 @@ <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). + ¾­ÓÉ HTTP POST ·½·¨Ìá½»ÖÁ½Å±¾µÄ±äÁ¿¡£ÀàËÆÓÚ¾ÉÊý×é <varname>$HTTP_POST_VARS</varname> + Êý×飨ÒÀÈ»ÓÐЧ£¬µ«·´¶ÔʹÓã©¡£ </simpara> </listitem> </varlistentry> @@ -207,9 +190,8 @@ <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). + ¾­ÓÉ HTTP Cookies ·½·¨Ìá½»ÖÁ½Å±¾µÄ±äÁ¿¡£ÀàËÆÓÚ¾ÉÊý×é <varname>$HTTP_COOKIE_VARS</varname> + Êý×飨ÒÀÈ»ÓÐЧ£¬µ«·´¶ÔʹÓã©¡£ </simpara> </listitem> </varlistentry> @@ -217,12 +199,8 @@ <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. + ¾­ÓÉ HTTP POST ÎļþÉÏ´«¶øÌá½»ÖÁ½Å±¾µÄ±äÁ¿¡£ÀàËÆÓÚ¾ÉÊý×é <varname>$HTTP_POST_FILES</varname> + Êý×飨ÒÀÈ»ÓÐЧ£¬µ«·´¶ÔʹÓã©¡£ÏêϸÐÅÏ¢Çë²ÎÔÄ <link linkend="features.file-upload.post-method">POST ·½·¨ÉÏ´«</link>¡£ </simpara> </listitem> </varlistentry> @@ -230,9 +208,8 @@ <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). + Ö´Ðл·¾³Ìá½»ÖÁ½Å±¾µÄ±äÁ¿¡£ÀàËÆÓÚ¾ÉÊý×é <varname>$HTTP_ENV_VARS</varname> + Êý×飨ÒÀÈ»ÓÐЧ£¬µ«·´¶ÔʹÓã©¡£ </simpara> </listitem> </varlistentry> @@ -240,20 +217,13 @@ <term><link linkend="reserved.variables.request">$_REQUEST</link></term> <listitem> <simpara> - Variables provided to the script via any user input mechanism, - and which therefore cannot be trusted. The presence and order - of variable inclusion in this array is defined according to the <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>. + ¾­ÓÉÈκÎÓû§ÊäÈë»úÖÆÌá½»ÖÁ½Å±¾µÄ±äÁ¿£¬Òò´Ë¸ÃÊý×é²¢²»ÖµµÃÐÅÈΡ£ËùÓаüº¬ÔÚ¸ÃÊý×éÖеıäÁ¿µÄ´æÔÚÓë·ñ + ÒÔ¼°±äÁ¿µÄ˳Ðò¾ù°´ÕÕ &php.ini; ÖÐµÄ <link linkend="ini.variables-order">variables_order</link> + ÅäÖÃָʾÀ´¶¨Òå¡£¸ÃÊý×éûÓÐÖ±½ÓÄ£Äâ PHP 4.1.0 µÄÔçÆÚ°æ±¾¡£²ÎÕÕ <function>import_request_variables</function>¡£ </simpara> <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. + µ±ÔËÐÐÓÚ <link linkend="features.commandline">ÃüÁîÐÐ</link> ģʽʱ£¬Õâ¸öÊý×齫 <emphasis>²»»á</emphasis> °üº¬ <varname>argv</varname> ºÍ <varname>argc</varname> Èë¿Ú£»ËýÃÇÒѾ­´æÔÚÓÚÊý×é <varname>$_SERVER</varname> ÖС£ </simpara> </note> </listitem> @@ -262,12 +232,7 @@ <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. + µ±Ç°×¢²á¸ø½Å±¾»á»°µÄ±äÁ¿¡£ÀàËÆÓÚ¾ÉÊý×é <varname>$HTTP_SESSION_VARS</varname> Êý×飨ÒÀÈ»ÓÐЧ£¬µ«·´¶ÔʹÓã©¡£ÏêϸÐÅÏ¢£¬Çë²ÎÕÕ <link linkend="ref.session">Session ´¦Àíº¯Êý</link> Õ½ڡ£ </simpara> </listitem> </varlistentry> @@ -280,10 +245,7 @@ <title>±äÁ¿·¶Î§</title> <simpara> - The scope of a variable is the context within which it is defined. - For the most part all PHP variables only have a single scope. - This single scope spans included and required files as well. For - example: + ±äÁ¿µÄ·¶Î§¼´Ëü¶¨ÒåµÄÉÏÏÂÎı³¾°£¨ÒëÕß:˵°×ÁË£¬Ò²¾ÍÊÇËüµÄÉúЧ·¶Î§£©¡£´ó²¿·ÖµÄ PHP ±äÁ¿Ö»ÓÐÒ»¸öµ¥¶ÀµÄ·¶Î§¡£Õâ¸öµ¥¶ÀµÄ·¶Î§¿ç¶ÈͬÑù°üº¬ÁË include ºÍ require ÒýÈëµÄÎļþ¡£·¶Àý: </simpara> <informalexample> <programlisting role="php"> @@ -296,11 +258,7 @@ </programlisting> </informalexample> <simpara> - Here the <varname>$a</varname> variable will be available within - the included <filename>b.inc</filename> script. However, within - user-defined functions a local function scope is introduced. Any - variable used inside a function is by default limited to the local - function scope. For example: + ÕâÀï±äÁ¿ <varname>$a</varname> ½«»áÔÚ°üº¬Îļþ <filename>b.inc</filename> ÖÐÉúЧ¡£µ«ÊÇ£¬ÔÚÓû§×Ô¶¨Ò庯ÊýÖУ¬Ò»¸ö¾Ö²¿º¯Êý·¶Î§½«±»ÒýÈë¡£ÈκÎÓÃÓÚº¯ÊýÄÚ²¿µÄ±äÁ¿°´È±Ê¡Çé¿ö½«±»ÏÞÖÆÔÚ¾Ö²¿º¯Êý·¶Î§ÄÚ¡£·¶Àý£º </simpara> <informalexample> @@ -321,16 +279,7 @@ </informalexample> <simpara> - This script will not produce any output because the echo statement - refers to a local version of the <varname>$a</varname> variable, - and it has not been assigned a value within this scope. You may - notice that this is a little bit different from the C language in - that global variables in C are automatically available to - functions unless specifically overridden by a local definition. - This can cause some problems in that people may inadvertently - change a global variable. In PHP global variables must be - declared global inside a function if they are going to be used in - that function. An example: + Õâ¸ö½Å±¾²»»áÓÐÈκÎÊä³öÒòΪ echo Óï¾äÒýÓÃÁËÒ»¸ö¾Ö²¿°æ±¾µÄ±äÁ¿ <varname>$a</varname>£¬ ¶øÇÒÔÚÕâ¸ö·¶Î§ÄÚ£¬Ëü²¢Ã»Óб»¸³Öµ¡£Äã¿ÉÄÜ×¢Òâµ½ PHP µÄÈ«¾Ö±äÁ¿ºÍ C ÓïÑÔÓÐÒ»µãµã²»Í¬£¬ÔÚ C ÓïÑÔÖУ¬È«¾Ö±äÁ¿ÔÚº¯ÊýÖÐ×Ô¶¯ÉúЧ£¬³ý·Ç±»¾Ö²¿±äÁ¿¸²¸Ç¡£Õâ¿ÉÄÜÒýÆðһЩÎÊÌ⣬ÓÐЩÈË¿ÉÄÜÂþ²»¾­ÐĵĸıäÒ»¸öÈ«¾Ö±äÁ¿¡£ PHP ÖÐÈ«¾Ö±äÁ¿ÔÚº¯ÊýÖÐʹÓÃʱ±ØÐëÉêÃ÷Ϊȫ¾Ö¡£ÀýÈ磺 </simpara> <informalexample> @@ -360,6 +309,7 @@ function, all references to either variable will refer to the global version. There is no limit to the number of global variables that can be manipulated by a function. + ÉÏÃæµÄ½Å±¾½«»áÊä³ö &quot;3&quot;¡£ </simpara> <simpara>
« previous php.doc.zh (#479) next »