avenger Wed Nov 6 11:21:42 2002 EDT Modified files: /phpdoc/en/reference/http reference.xml /phpdoc/en/reference/http/functions header.xml Log: finished Index: phpdoc/en/reference/http/reference.xml diff -u phpdoc/en/reference/http/reference.xml:1.4 phpdoc/en/reference/http/reference.xml:1.5 --- phpdoc/en/reference/http/reference.xml:1.4 Fri Aug 9 06:26:02 2002 +++ phpdoc/en/reference/http/reference.xml Wed Nov 6 11:21:38 2002 @@ -1,15 +1,14 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.4 $ --> +<!-- $Revision: 1.5 $ --> <reference id="ref.http"> - <title>HTTP functions</title> + <title>HTTP 相关函数</title> <titleabbrev>HTTP</titleabbrev> <partintro> <section id="http.intro"> &reftitle.intro; <para> - These functions let you manipulate the output sent back to the - remote browser right down to the HTTP protocol level. + 这些函数可以让你依据 HTTP 标准协议向客户端浏览器发送头部信息。 </para> </section> Index: phpdoc/en/reference/http/functions/header.xml diff -u phpdoc/en/reference/http/functions/header.xml:1.6 phpdoc/en/reference/http/functions/header.xml:1.7 --- phpdoc/en/reference/http/functions/header.xml:1.6 Thu Oct 17 16:33:03 2002 +++ phpdoc/en/reference/http/functions/header.xml Wed Nov 6 11:21:40 2002 @@ -1,13 +1,13 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.6 $ --> +<!-- $Revision: 1.7 $ --> <!-- splitted from ./en/functions/http.xml, last change in rev 1.2 --> <refentry id="function.header"> <refnamediv> <refname>header</refname> - <refpurpose>Send a raw HTTP header</refpurpose> + <refpurpose>向浏览器发送一个 HTTP 头部信息</refpurpose> </refnamediv> <refsect1> - <title>Description</title> + <title>描述</title> <methodsynopsis> <type>int</type><methodname>header</methodname> <methodparam><type>string</type><parameter>string</parameter></methodparam> @@ -15,17 +15,14 @@ <methodparam choice="opt"><type>int</type><parameter>http_reponse_code</parameter></methodparam> </methodsynopsis> <para> - <function>header</function> is used to send raw - <acronym>HTTP</acronym> headers. See the <ulink - url="&spec.http1.1;">HTTP/1.1 specification</ulink> for more - information on <acronym>HTTP</acronym> headers. + <function>header</function> 函数用来发送一个 <acronym>HTTP</acronym> + 头部信息到客户端的浏览器。有关 <acronym>HTTP</acronym> +头部信息的更多内容参见官方文档 + <ulink url="&spec.http1.1;">HTTP/1.1 specification</ulink>。 </para> <para> - The optional <parameter>replace</parameter> parameter indicates - whether the header should replace a previous similar header, or - add a second header of the same type. By default it will replace, - but if you pass in &false; as the second argument you can force - multiple headers of the same type. For example: + 可选参数 <parameter>replace</parameter> + +用来表示当出现两个相似的头部信息时,是替换前一个相同的头部信息还是增加一个相同的头部信息。默认为替换,如果你将其设为 + &false; 则可以多次发送相同的头部信息。例如: <informalexample> <programlisting role="php"> <![CDATA[ @@ -38,15 +35,12 @@ </informalexample> </para> <para> - The second optional <parameter>http_response_code</parameter> force the - HTTP response code to the specified value. (This parameter is available - in PHP 4.3.0 and higher.) + 第二个可选参数 <parameter>http_response_code</parameter> 表示 HTTP + 的头部信息的代码。(此参数在PHP 4.3.0 被加入。) </para> <para> - There are two special-case header calls. The first is a header - that starts with the string "<literal>HTTP/</literal>" (case is not - significant), which will be used to figure out the HTTP status - code to send. For example, if you have configured Apache to + 头部信息的格式有两种形式。一种情况是以字符 “<literal>HTTP/</literal>” +(不区分大小写)开头的,which will be used to figure out the HTTP status + code to send。例如,如果你if you have configured Apache to use a PHP script to handle requests for missing files (using the <literal>ErrorDocument</literal> directive), you may want to make sure that your script generates the proper status code. @@ -61,6 +55,7 @@ </informalexample> <note> <para> + HTTP 头部信息经常首先被发送到客户端, The HTTP status header line will always be the first sent to the client, regardless of the actual <function>header</function> call beeing the first or not. The status may be overridden @@ -70,9 +65,8 @@ </note> <note> <para> - In PHP 3, this only works when PHP is compiled as an Apache - module. You can achieve the same effect using the - <literal>Status</literal> header. + 在 PHP 3 中,此函数只在 PHP 以 Apache 的模块化运行的时候有效。你可以使用 +<literal>Status</literal> + 来达到相同的效果。 <informalexample> <programlisting role="php"> <![CDATA[ @@ -86,7 +80,7 @@ </note> </para> <para> - The second special case is the "Location:" header. Not only does + 第二种特殊情况是以 "Location:" 开头的信息。Not only does it send this header back to the browser, but it also returns a <literal>REDIRECT</literal> (302) status code to the browser unless some <literal>3xx</literal> status code has already been set. @@ -104,13 +98,11 @@ </para> <note> <para> - HTTP/1.1 requires an absolute <acronym>URI</acronym> as argument to + HTTP/1.1 标准需要一个绝对地址的 <acronym>URI</acronym> 做为 <ulink url="&spec.http1.1;-sec14.html#sec14.30">Location:</ulink> - including the scheme, hostname and absolute path, but - some clients accept relative URIs. You can usually use - <literal>$_SERVER['HTTP_HOST']</literal>, <literal>$_SERVER['PHP_SELF']</literal> - and <function>dirname</function> to make an absolute URI from a - relative one yourself: + 的参数, 但有一些客户端支持虚拟的路径。你通常可以使用 + +<literal>$_SERVER['HTTP_HOST']</literal>、<literal>$_SERVER['PHP_SELF']</literal> + 及 <function>dirname</function> 函数来自己获取所需要的绝对路径: <informalexample> <programlisting> <![CDATA[ @@ -125,11 +117,8 @@ </para> </note> <para> - PHP scripts often generate dynamic content that must not be cached - by the client browser or any proxy caches between the server and the - client browser. Many proxies and clients can be forced to disable - caching with - <informalexample> + PHP +脚本通常是动态改变的。可有些客户端或一些代理服务器会把一些浏览过的内容给缓冲起来,这样您更新的脚本就不能被客户端及时的发现,你可以通过发送一些类似下面例子中的头部信息来禁止他们缓存你的网页。 + <informalexample> <programlisting role="php"> <![CDATA[ <?php @@ -145,16 +134,15 @@ </informalexample> <note> <para> - You may find that your pages aren't cached even if you don't - output all of the headers above. There are a number of options + +你可能会发现即使你没有把上边的代码全部输出你的网页也没有被缓冲起来。这是因为一些用户在他们的浏览器的设置There + are a number of options that users may be able to set for their browser that change its default caching behavior. By sending the headers above, you should override any settings that may otherwise cause the output of your script to be cached. </para> <para> - Additionally, <function>session_cache_limiter</function> and - the <literal>session.cache_limiter</literal> configuration + 另外,<function>session_cache_limiter</function> 和 + <literal>session.cache_limiter</literal> configuration setting can be used to automatically generate the correct caching-related headers when sessions are being used. </para>
-- PHP Documentation Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php