cvs: phpdoc-zh /reference/http/functions header.xml
| From: | liuming | Date: | Thu, 18 Aug 2005 06:34:55 +0000 |
| Subject: | cvs: phpdoc-zh /reference/http/functions header.xml | ||
| Groups: | php.doc.zh | ||
| Request: | Send a blank email to doc-zh+get-2403@lists.php.net to get a copy of this message | ||
lm92 Thu Aug 18 02:34:55 2005 EDT
Modified files:
/phpdoc-zh/reference/http/functions header.xml
Log:
updated to en version
http://cvs.php.net/diff.php/phpdoc-zh/reference/http/functions/header.xml?r1=1.2&r2=1.3&ty=u Index: phpdoc-zh/reference/http/functions/header.xml diff -u phpdoc-zh/reference/http/functions/header.xml:1.2 phpdoc-zh/reference/http/functions/header.xml:1.3 --- phpdoc-zh/reference/http/functions/header.xml:1.2 Wed Jul 13 12:12:33 2005 +++ phpdoc-zh/reference/http/functions/header.xml Thu Aug 18 02:34:55 2005 @@ -1,8 +1,7 @@ -<?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.2 $ --> -<!-- $Author: yincheng $ --> -<!-- EN-Revision: 1.8 Maintainer: Avenger Status: working --> -<!-- splitted from ./en/functions/http.xml, last change in rev 1.2 --> +<?xml version="1.0" encoding="gb2312"?> +<!-- $Revision: 1.3 $ --> +<!-- $Author: lm92 $ --> +<!-- EN-Revision: 1.25 Maintainer: Avenger Status: ready --> <refentry id="function.header"> <refnamediv> <refname>header</refname> @@ -11,26 +10,27 @@ <refsect1> <title>ÃèÊö</title> <methodsynopsis> - <type>int</type><methodname>header</methodname> + <type>void</type><methodname>header</methodname> <methodparam><type>string</type><parameter>string</parameter></methodparam> <methodparam choice="opt"><type>bool</type><parameter>replace</parameter></methodparam> - <methodparam choice="opt"><type>int</type><parameter>http_reponse_code</parameter></methodparam> - </methodsynopsis> + <methodparam choice="opt"><type>int</type><parameter>http_response_code</parameter></methodparam> <para> <function>header</function> º¯ÊýÓÃÀ´·¢ËÍÒ»¸ö <acronym>HTTP</acronym> Í·²¿ÐÅÏ¢µ½¿Í»§¶ËµÄä¯ÀÀÆ÷¡£ÓÐ¹Ø <acronym>HTTP</acronym> Í·²¿ÐÅÏ¢µÄ¸ü¶àÄÚÈݲμû¹Ù·½Îĵµ - <ulink url="&spec.http1.1;">HTTP/1.1 specification</ulink>¡£ + <ulink url="&url.rfc;2616">HTTP/1.1 specification</ulink>¡£ </para> <para> ¿ÉÑ¡²ÎÊý <parameter>replace</parameter> ÓÃÀ´±íʾµ±³öÏÖÁ½¸öÏàËÆµÄÍ·²¿ÐÅϢʱ£¬ÊÇÌæ»»Ç°Ò»¸öÏàͬµÄÍ·²¿ÐÅÏ¢»¹ÊÇÔö¼ÓÒ»¸öÏàͬµÄÍ·²¿ÐÅÏ¢¡£Ä¬ÈÏÎªÌæ»»£¬Èç¹ûÄ㽫ÆäÉèΪ &false; Ôò¿ÉÒÔ¶à´Î·¢ËÍÏàͬµÄÍ·²¿ÐÅÏ¢¡£ÀýÈç: + </para> + <para> <informalexample> <programlisting role="php"> <![CDATA[ <?php header('WWW-Authenticate: Negotiate'); -header('WWW-Authenticate: NTLM', FALSE); +header('WWW-Authenticate: NTLM', false); ?> ]]> </programlisting> @@ -44,15 +44,18 @@ Í·²¿ÐÅÏ¢µÄ¸ñʽÓÐÁ½ÖÖÐÎʽ¡£Ò»ÖÖÇé¿öÊÇÒÔ×Ö·û ¡°<literal>HTTP/</literal>¡± (²»Çø·Ö´óСд)¿ªÍ·µÄ£¬which will be used to figure out the HTTP status code to send¡£ÀýÈç,Èç¹ûÄãʹÓÃµÄ WEB ·þÎñÆ÷ÊÇ Apache µÄ»°£¬Èç¹ûÒªÖÆ×÷Ò»¸öÕÒ²»µ½ÎÄÕµĴíÎó´¦ÀíÒ³Ãæ (ʹÓà <literal>ErrorDocument</literal> Ö¸Áî)£¬Äã¿ÉÄÜ»áÐèÒªÓÃËüÀ´²úÉúһЩÊʵ±µÄ״̬´úÂë¡£ + </para> + <para> <informalexample> <programlisting role="php"> <![CDATA[ <?php - header("HTTP/1.0 404 Not Found"); +header("HTTP/1.0 404 Not Found") ?> ]]> </programlisting> </informalexample> + </para> <note> <para> HTTP Í·²¿ÐÅϢͨ³£ÊÇÊ×Ïȱ»·¢Ë͵½¿Í»§¶ËµÄ£¬Ëü²¢²»¹ÜÄãµÄ <function>header</function> @@ -81,13 +84,14 @@ <para> µÚ¶þÖÖÌØÊâÇé¿öÊÇÒÔ "Location:" ¿ªÍ·µÄÐÅÏ¢¡£Ëü²»Ö»ÊǼòµ¥µÄÏòä¯ÀÀÆ÷·¢ËÍһЩͷ²¿ÐÅÏ¢£¬Í¨³£Ëü»áÏòä¯ÀÀÆ÷·¢ËͳöÒ»¸ö <literal>REDIRECT</literal> (302) (Ìø×ª) ״̬´úÂ룬³ý·ÇһЩÀàËÆÓÚ <literal>3xx</literal> µÄ״̬´úÂëÒѾ±»·¢ËÍ¡£ + </para> + <para> <informalexample> <programlisting role="php"> <![CDATA[ <?php -header("Location: http://www.example.com/"); /* Redirect browser */ -exit; /* Make sure that code below does - not get executed when we redirect. */ +header("Location: http://www.example.com/"); /* ÖØ¶¨Ïòä¯ÀÀÆ÷ */ +exit; /* È·±£Öض¨Ê±£¬ºóÐø´úÂë²»»á±»Ö´ÐÐ */ ?> ]]> </programlisting> @@ -115,64 +119,80 @@ </note> <para> PHP ½Å±¾Í¨³£ÊǶ¯Ì¬¸Ä±äµÄ¡£¿ÉÓÐЩ¿Í»§¶Ë»òһЩ´úÀí·þÎñÆ÷»á°ÑһЩä¯ÀÀ¹ýµÄÄÚÈݸø»º³åÆðÀ´£¬ÕâÑùÄú¸üеĽű¾¾Í²»Äܱ»¿Í»§¶Ë¼°Ê±µÄ·¢ÏÖ£¬Äã¿ÉÒÔͨ¹ý·¢ËÍһЩÀàËÆÏÂÃæÀý×ÓÖеÄÍ·²¿ÐÅÏ¢À´½ûÖ¹ËûÃÇ»º´æÄãµÄÍøÒ³¡£ - <informalexample> + </para> + <para> + <informalexample> <programlisting role="php"> <![CDATA[ <?php -header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past +// Date in the past +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); + +// always modified header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); - // always modified -header("Cache-Control: no-store, no-cache, must-revalidate"); // HTTP/1.1 + +// HTTP/1.1 +header("Cache-Control: no-store, no-cache, must-revalidate"); + header("Cache-Control: post-check=0, pre-check=0", false); -header("Pragma: no-cache"); // HTTP/1.0 + +// HTTP/1.0 +header("Pragma: no-cache"); ?> ]]> </programlisting> </informalexample> - <note> - <para> - Äã¿ÉÄܻᷢÏÖ¼´Ê¹ÄãûÓаÑÉϱߵĴúÂëÈ«²¿Êä³öÄãµÄÍøÒ³Ò²Ã»Óб»»º³åÆðÀ´¡£ÕâÊÇÒòΪһЩÓû§ÔÚËûÃǵÄä¯ÀÀÆ÷µÄһЩѡÏîÉèÖÃÖÐÉèÖÃÁ˽ûÖ¹»º´æÎļþµÄÑ¡Ïî¡£ - </para> - <para> - ÁíÍ⣬µ± session ÔÚ´úÂëÖб»Ê¹ÓÃʱ£¬ÀûÓà <function>session_cache_limiter</function> º¯ÊýºÍ - <literal>session.cache_limiter</literal> Ñ¡Ïî¿ÉÒÔ×Ô¶¯µÄ²úÉúÏà¹ØµÄ»º³åÇø¡£ - </para> - </note> </para> + <note> + <para> + Äã¿ÉÄܻᷢÏÖ¼´Ê¹ÄãûÓаÑÉϱߵĴúÂëÈ«²¿Êä³öÄãµÄÍøÒ³Ò²Ã»Óб»»º³åÆðÀ´¡£ÕâÊÇÒòΪһЩÓû§ÔÚËûÃǵÄä¯ÀÀÆ÷µÄһЩѡÏîÉèÖÃÖÐÉèÖÃÁ˽ûÖ¹»º´æÎļþµÄÑ¡Ïî¡£ + </para> + <para> + ÁíÍ⣬µ± session ÔÚ´úÂëÖб»Ê¹ÓÃʱ£¬ÀûÓà <function>session_cache_limiter</function> º¯ÊýºÍ + <literal>session.cache_limiter</literal> Ñ¡Ïî¿ÉÒÔ×Ô¶¯µÄ²úÉúÏà¹ØµÄ»º³åÇø¡£ + </para> + </note> <para> ÒªÀÎ¼Ç <function>header</function> ҪʹÓÃÔÚÈκÎÍøÒ³Êä³öǰ¡£°üÀ¨Ò»Ð©·Ç HTML ±êÇ©ºÍ¿ÕÐж¼²»ÔÊÐíÔÚÆä֮ǰÊä³ö¡£ÔÚʹÓà <function>include</function> ¡¢<function>require</function> º¯Êý»òһЩÆäËüµÄÎļþ´æÈ¡ÀຯÊýʱ£¬ÕâÊÇÒ»¸öºÜ³£·¸µÄ´íÎó¡£Í¬ÑùÔÚÒ»¸öµ¥¶ÀµÄ PHP/HTML ÎļþÖÐÕâ¸ö´íÎóÒ²ºÜÆÕ±é¡£ + </para> + <para> <informalexample> <programlisting role="php"> <![CDATA[ - -<?php header ("Content-type: audio/x-pn-realaudio"); ?> -// ³ö´í£¬×¢Òâ header ǰµÄ¿Õ¸ñ +<html> +<?php +/* Õ⽫²úÉúÒ»¸ö´íÎó£¬ÒòΪÔÚµ÷ header() + * ֮ǰÒѾÊä³öÁ˶«Î÷ */ +header('Location: http://www.example.com/'); +?> ]]> </programlisting> </informalexample> - <note> - <para> - ÔÚ PHP 4ÀÄã¿ÉÒÔͨ¹ýһЩÊä³ö»º³åº¯ÊýÀ´½â¾öÕâ¸öÎÊÌâ¡£ÕâÑù×ö£¬Äã¿ÉÒÔ°ÑËùÓеÄÊä³ö¶¼»º³åµ½·þÎñ£¬Ö±µ½ÄãÏÂÃüÁî·¢ËÍËüÃÇ¡£Äã¿ÉÒÔÔÚÄãµÄ´úÂëÖÐʹÓà <function>ob_start</function> ¼° <function>ob_end_flush</function> - À´ÊµÏÖÕâÑùµÄ¹¦ÄÜ£¬»òÕßͨ¹ýÐÞ¸ÄÄãµÄ &php.ini; ÖÐµÄ <literal>output_buffering</literal> - Ñ¡ÏîÀ´ÊµÏÖ£¬Ò²¿ÉÒÔͨ¹ýÐÞ¸ÄÄãµÄ·þÎñÆ÷ÅäÖÃÎļþÀ´ÊµÏÖ¡£ - </para> - </note> </para> + <note> + <para> + ÔÚ PHP 4ÀÄã¿ÉÒÔͨ¹ýһЩÊä³ö»º³åº¯ÊýÀ´½â¾öÕâ¸öÎÊÌâ¡£ÕâÑù×ö£¬Äã¿ÉÒÔ°ÑËùÓеÄÊä³ö¶¼»º³åµ½·þÎñ£¬Ö±µ½ÄãÏÂÃüÁî·¢ËÍËüÃÇ¡£Äã¿ÉÒÔÔÚÄãµÄ´úÂëÖÐʹÓà <function>ob_start</function> ¼° <function>ob_end_flush</function> + À´ÊµÏÖÕâÑùµÄ¹¦ÄÜ£¬»òÕßͨ¹ýÐÞ¸ÄÄãµÄ &php.ini; ÖÐµÄ <literal>output_buffering</literal> + Ñ¡ÏîÀ´ÊµÏÖ£¬Ò²¿ÉÒÔͨ¹ýÐÞ¸ÄÄãµÄ·þÎñÆ÷ÅäÖÃÎļþÀ´ÊµÏÖ¡£ + </para> + </note> <para> Èç¹ûÄãÏëÌáʾÓû§ÏÂÔØ²¢±£´æÒ»¸öÎļþ£¬ÀýÈçÒ»¸ö PDF Îļþ£¬Äã¿ÉÒÔͨ¹ý·¢ËÍ <ulink url="&url.rfc;2183">Content-Disposition</ulink> ÐÅÏ¢À´Ê¹¿Í»§¶Ë»úÆ÷µ¯³öÏÂÔØ¶Ô»°¿òÀ´ÏÂÔØÄúÐèÒª´¦ÀíµÄÎļþ¡£ + </para> + <para> <informalexample> <programlisting role="php"> <![CDATA[ <?php // ÕâÑù½«»áÖ±½ÓÊä³öÒ»¸ö PDF Îļþ -header("Content-type: application/pdf"); +header('Content-type: application/pdf'); // ÕâÑù×ö¾Í»áÌáʾÏÂÔØ PDF Îļþ downloaded.pdf -header("Content-Disposition: attachment; filename=downloaded.pdf"); +header('Content-Disposition: attachment; filename="downloaded.pdf"'); // ÕâÊÇ original.pdf µÄÔ´Îļþ readfile('original.pdf'); @@ -180,14 +200,15 @@ ]]> </programlisting> </informalexample> - <note> - <para> - Microsoft Internet Explorer 4.01 ÖеÄÒ»¸ö©¶´Ê¹µÃ¸Ã»úÖÆÎÞ·¨Õý³£¹¤×÷¡£ÔÚ Microsoft Internet Explorer 5 - ÖÐÕâ¸ö©¶´ÒÀÈ»´æÔÚ£¬Éý¼¶ Service Pack 2 ¼°ÆäÒÔºó°æ±¾ÖÐÕâ¸ö©¶´½«²»¸´´æÔÚ¡£ - </para> - </note> </para> <note> + <para> + Microsoft Internet Explorer 4.01 ÖеÄÒ»¸ö©¶´Ê¹µÃ¸Ã»úÖÆÎÞ·¨Õý³£¹¤×÷¡£ÔÚ + Microsoft Internet Explorer 5 + ÖÐÕâ¸ö©¶´ÒÀÈ»´æÔÚ£¬Éý¼¶ Service Pack 2 ¼°ÆäÒÔºó°æ±¾ÖÐÕâ¸ö©¶´½«²»¸´´æÔÚ¡£ + </para> + </note> + <note> <simpara> Èç¹û PHP ÔËÐÐÔÚ°²È«Ä£Ê½ (<link linkend="ini.safe-mode">safe mode</link>) Ï£¬µ±Ç°Ê¹ÓÃÕߵıêʶºÅ (UID) »á¸½¼Óµ½Í·²¿ÐÅÏ¢ <literal>WWW-Authenticate</literal>
http://cvs.php.net/diff.php/phpdoc-zh/reference/http/functions/header.xml?r1=1.2&r2=1.3&ty=u Index: phpdoc-zh/reference/http/functions/header.xml diff -u phpdoc-zh/reference/http/functions/header.xml:1.2 phpdoc-zh/reference/http/functions/header.xml:1.3 --- phpdoc-zh/reference/http/functions/header.xml:1.2 Wed Jul 13 12:12:33 2005 +++ phpdoc-zh/reference/http/functions/header.xml Thu Aug 18 02:34:55 2005 @@ -1,8 +1,7 @@ -<?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.2 $ --> -<!-- $Author: yincheng $ --> -<!-- EN-Revision: 1.8 Maintainer: Avenger Status: working --> -<!-- splitted from ./en/functions/http.xml, last change in rev 1.2 --> +<?xml version="1.0" encoding="gb2312"?> +<!-- $Revision: 1.3 $ --> +<!-- $Author: lm92 $ --> +<!-- EN-Revision: 1.25 Maintainer: Avenger Status: ready --> <refentry id="function.header"> <refnamediv> <refname>header</refname> @@ -11,26 +10,27 @@ <refsect1> <title>ÃèÊö</title> <methodsynopsis> - <type>int</type><methodname>header</methodname> + <type>void</type><methodname>header</methodname> <methodparam><type>string</type><parameter>string</parameter></methodparam> <methodparam choice="opt"><type>bool</type><parameter>replace</parameter></methodparam> - <methodparam choice="opt"><type>int</type><parameter>http_reponse_code</parameter></methodparam> - </methodsynopsis> + <methodparam choice="opt"><type>int</type><parameter>http_response_code</parameter></methodparam> <para> <function>header</function> º¯ÊýÓÃÀ´·¢ËÍÒ»¸ö <acronym>HTTP</acronym> Í·²¿ÐÅÏ¢µ½¿Í»§¶ËµÄä¯ÀÀÆ÷¡£ÓÐ¹Ø <acronym>HTTP</acronym> Í·²¿ÐÅÏ¢µÄ¸ü¶àÄÚÈݲμû¹Ù·½Îĵµ - <ulink url="&spec.http1.1;">HTTP/1.1 specification</ulink>¡£ + <ulink url="&url.rfc;2616">HTTP/1.1 specification</ulink>¡£ </para> <para> ¿ÉÑ¡²ÎÊý <parameter>replace</parameter> ÓÃÀ´±íʾµ±³öÏÖÁ½¸öÏàËÆµÄÍ·²¿ÐÅϢʱ£¬ÊÇÌæ»»Ç°Ò»¸öÏàͬµÄÍ·²¿ÐÅÏ¢»¹ÊÇÔö¼ÓÒ»¸öÏàͬµÄÍ·²¿ÐÅÏ¢¡£Ä¬ÈÏÎªÌæ»»£¬Èç¹ûÄ㽫ÆäÉèΪ &false; Ôò¿ÉÒÔ¶à´Î·¢ËÍÏàͬµÄÍ·²¿ÐÅÏ¢¡£ÀýÈç: + </para> + <para> <informalexample> <programlisting role="php"> <![CDATA[ <?php header('WWW-Authenticate: Negotiate'); -header('WWW-Authenticate: NTLM', FALSE); +header('WWW-Authenticate: NTLM', false); ?> ]]> </programlisting> @@ -44,15 +44,18 @@ Í·²¿ÐÅÏ¢µÄ¸ñʽÓÐÁ½ÖÖÐÎʽ¡£Ò»ÖÖÇé¿öÊÇÒÔ×Ö·û ¡°<literal>HTTP/</literal>¡± (²»Çø·Ö´óСд)¿ªÍ·µÄ£¬which will be used to figure out the HTTP status code to send¡£ÀýÈç,Èç¹ûÄãʹÓÃµÄ WEB ·þÎñÆ÷ÊÇ Apache µÄ»°£¬Èç¹ûÒªÖÆ×÷Ò»¸öÕÒ²»µ½ÎÄÕµĴíÎó´¦ÀíÒ³Ãæ (ʹÓà <literal>ErrorDocument</literal> Ö¸Áî)£¬Äã¿ÉÄÜ»áÐèÒªÓÃËüÀ´²úÉúһЩÊʵ±µÄ״̬´úÂë¡£ + </para> + <para> <informalexample> <programlisting role="php"> <![CDATA[ <?php - header("HTTP/1.0 404 Not Found"); +header("HTTP/1.0 404 Not Found") ?> ]]> </programlisting> </informalexample> + </para> <note> <para> HTTP Í·²¿ÐÅϢͨ³£ÊÇÊ×Ïȱ»·¢Ë͵½¿Í»§¶ËµÄ£¬Ëü²¢²»¹ÜÄãµÄ <function>header</function> @@ -81,13 +84,14 @@ <para> µÚ¶þÖÖÌØÊâÇé¿öÊÇÒÔ "Location:" ¿ªÍ·µÄÐÅÏ¢¡£Ëü²»Ö»ÊǼòµ¥µÄÏòä¯ÀÀÆ÷·¢ËÍһЩͷ²¿ÐÅÏ¢£¬Í¨³£Ëü»áÏòä¯ÀÀÆ÷·¢ËͳöÒ»¸ö <literal>REDIRECT</literal> (302) (Ìø×ª) ״̬´úÂ룬³ý·ÇһЩÀàËÆÓÚ <literal>3xx</literal> µÄ״̬´úÂëÒѾ±»·¢ËÍ¡£ + </para> + <para> <informalexample> <programlisting role="php"> <![CDATA[ <?php -header("Location: http://www.example.com/"); /* Redirect browser */ -exit; /* Make sure that code below does - not get executed when we redirect. */ +header("Location: http://www.example.com/"); /* ÖØ¶¨Ïòä¯ÀÀÆ÷ */ +exit; /* È·±£Öض¨Ê±£¬ºóÐø´úÂë²»»á±»Ö´ÐÐ */ ?> ]]> </programlisting> @@ -115,64 +119,80 @@ </note> <para> PHP ½Å±¾Í¨³£ÊǶ¯Ì¬¸Ä±äµÄ¡£¿ÉÓÐЩ¿Í»§¶Ë»òһЩ´úÀí·þÎñÆ÷»á°ÑһЩä¯ÀÀ¹ýµÄÄÚÈݸø»º³åÆðÀ´£¬ÕâÑùÄú¸üеĽű¾¾Í²»Äܱ»¿Í»§¶Ë¼°Ê±µÄ·¢ÏÖ£¬Äã¿ÉÒÔͨ¹ý·¢ËÍһЩÀàËÆÏÂÃæÀý×ÓÖеÄÍ·²¿ÐÅÏ¢À´½ûÖ¹ËûÃÇ»º´æÄãµÄÍøÒ³¡£ - <informalexample> + </para> + <para> + <informalexample> <programlisting role="php"> <![CDATA[ <?php -header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past +// Date in the past +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); + +// always modified header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); - // always modified -header("Cache-Control: no-store, no-cache, must-revalidate"); // HTTP/1.1 + +// HTTP/1.1 +header("Cache-Control: no-store, no-cache, must-revalidate"); + header("Cache-Control: post-check=0, pre-check=0", false); -header("Pragma: no-cache"); // HTTP/1.0 + +// HTTP/1.0 +header("Pragma: no-cache"); ?> ]]> </programlisting> </informalexample> - <note> - <para> - Äã¿ÉÄܻᷢÏÖ¼´Ê¹ÄãûÓаÑÉϱߵĴúÂëÈ«²¿Êä³öÄãµÄÍøÒ³Ò²Ã»Óб»»º³åÆðÀ´¡£ÕâÊÇÒòΪһЩÓû§ÔÚËûÃǵÄä¯ÀÀÆ÷µÄһЩѡÏîÉèÖÃÖÐÉèÖÃÁ˽ûÖ¹»º´æÎļþµÄÑ¡Ïî¡£ - </para> - <para> - ÁíÍ⣬µ± session ÔÚ´úÂëÖб»Ê¹ÓÃʱ£¬ÀûÓà <function>session_cache_limiter</function> º¯ÊýºÍ - <literal>session.cache_limiter</literal> Ñ¡Ïî¿ÉÒÔ×Ô¶¯µÄ²úÉúÏà¹ØµÄ»º³åÇø¡£ - </para> - </note> </para> + <note> + <para> + Äã¿ÉÄܻᷢÏÖ¼´Ê¹ÄãûÓаÑÉϱߵĴúÂëÈ«²¿Êä³öÄãµÄÍøÒ³Ò²Ã»Óб»»º³åÆðÀ´¡£ÕâÊÇÒòΪһЩÓû§ÔÚËûÃǵÄä¯ÀÀÆ÷µÄһЩѡÏîÉèÖÃÖÐÉèÖÃÁ˽ûÖ¹»º´æÎļþµÄÑ¡Ïî¡£ + </para> + <para> + ÁíÍ⣬µ± session ÔÚ´úÂëÖб»Ê¹ÓÃʱ£¬ÀûÓà <function>session_cache_limiter</function> º¯ÊýºÍ + <literal>session.cache_limiter</literal> Ñ¡Ïî¿ÉÒÔ×Ô¶¯µÄ²úÉúÏà¹ØµÄ»º³åÇø¡£ + </para> + </note> <para> ÒªÀÎ¼Ç <function>header</function> ҪʹÓÃÔÚÈκÎÍøÒ³Êä³öǰ¡£°üÀ¨Ò»Ð©·Ç HTML ±êÇ©ºÍ¿ÕÐж¼²»ÔÊÐíÔÚÆä֮ǰÊä³ö¡£ÔÚʹÓà <function>include</function> ¡¢<function>require</function> º¯Êý»òһЩÆäËüµÄÎļþ´æÈ¡ÀຯÊýʱ£¬ÕâÊÇÒ»¸öºÜ³£·¸µÄ´íÎó¡£Í¬ÑùÔÚÒ»¸öµ¥¶ÀµÄ PHP/HTML ÎļþÖÐÕâ¸ö´íÎóÒ²ºÜÆÕ±é¡£ + </para> + <para> <informalexample> <programlisting role="php"> <![CDATA[ - -<?php header ("Content-type: audio/x-pn-realaudio"); ?> -// ³ö´í£¬×¢Òâ header ǰµÄ¿Õ¸ñ +<html> +<?php +/* Õ⽫²úÉúÒ»¸ö´íÎó£¬ÒòΪÔÚµ÷ header() + * ֮ǰÒѾÊä³öÁ˶«Î÷ */ +header('Location: http://www.example.com/'); +?> ]]> </programlisting> </informalexample> - <note> - <para> - ÔÚ PHP 4ÀÄã¿ÉÒÔͨ¹ýһЩÊä³ö»º³åº¯ÊýÀ´½â¾öÕâ¸öÎÊÌâ¡£ÕâÑù×ö£¬Äã¿ÉÒÔ°ÑËùÓеÄÊä³ö¶¼»º³åµ½·þÎñ£¬Ö±µ½ÄãÏÂÃüÁî·¢ËÍËüÃÇ¡£Äã¿ÉÒÔÔÚÄãµÄ´úÂëÖÐʹÓà <function>ob_start</function> ¼° <function>ob_end_flush</function> - À´ÊµÏÖÕâÑùµÄ¹¦ÄÜ£¬»òÕßͨ¹ýÐÞ¸ÄÄãµÄ &php.ini; ÖÐµÄ <literal>output_buffering</literal> - Ñ¡ÏîÀ´ÊµÏÖ£¬Ò²¿ÉÒÔͨ¹ýÐÞ¸ÄÄãµÄ·þÎñÆ÷ÅäÖÃÎļþÀ´ÊµÏÖ¡£ - </para> - </note> </para> + <note> + <para> + ÔÚ PHP 4ÀÄã¿ÉÒÔͨ¹ýһЩÊä³ö»º³åº¯ÊýÀ´½â¾öÕâ¸öÎÊÌâ¡£ÕâÑù×ö£¬Äã¿ÉÒÔ°ÑËùÓеÄÊä³ö¶¼»º³åµ½·þÎñ£¬Ö±µ½ÄãÏÂÃüÁî·¢ËÍËüÃÇ¡£Äã¿ÉÒÔÔÚÄãµÄ´úÂëÖÐʹÓà <function>ob_start</function> ¼° <function>ob_end_flush</function> + À´ÊµÏÖÕâÑùµÄ¹¦ÄÜ£¬»òÕßͨ¹ýÐÞ¸ÄÄãµÄ &php.ini; ÖÐµÄ <literal>output_buffering</literal> + Ñ¡ÏîÀ´ÊµÏÖ£¬Ò²¿ÉÒÔͨ¹ýÐÞ¸ÄÄãµÄ·þÎñÆ÷ÅäÖÃÎļþÀ´ÊµÏÖ¡£ + </para> + </note> <para> Èç¹ûÄãÏëÌáʾÓû§ÏÂÔØ²¢±£´æÒ»¸öÎļþ£¬ÀýÈçÒ»¸ö PDF Îļþ£¬Äã¿ÉÒÔͨ¹ý·¢ËÍ <ulink url="&url.rfc;2183">Content-Disposition</ulink> ÐÅÏ¢À´Ê¹¿Í»§¶Ë»úÆ÷µ¯³öÏÂÔØ¶Ô»°¿òÀ´ÏÂÔØÄúÐèÒª´¦ÀíµÄÎļþ¡£ + </para> + <para> <informalexample> <programlisting role="php"> <![CDATA[ <?php // ÕâÑù½«»áÖ±½ÓÊä³öÒ»¸ö PDF Îļþ -header("Content-type: application/pdf"); +header('Content-type: application/pdf'); // ÕâÑù×ö¾Í»áÌáʾÏÂÔØ PDF Îļþ downloaded.pdf -header("Content-Disposition: attachment; filename=downloaded.pdf"); +header('Content-Disposition: attachment; filename="downloaded.pdf"'); // ÕâÊÇ original.pdf µÄÔ´Îļþ readfile('original.pdf'); @@ -180,14 +200,15 @@ ]]> </programlisting> </informalexample> - <note> - <para> - Microsoft Internet Explorer 4.01 ÖеÄÒ»¸ö©¶´Ê¹µÃ¸Ã»úÖÆÎÞ·¨Õý³£¹¤×÷¡£ÔÚ Microsoft Internet Explorer 5 - ÖÐÕâ¸ö©¶´ÒÀÈ»´æÔÚ£¬Éý¼¶ Service Pack 2 ¼°ÆäÒÔºó°æ±¾ÖÐÕâ¸ö©¶´½«²»¸´´æÔÚ¡£ - </para> - </note> </para> <note> + <para> + Microsoft Internet Explorer 4.01 ÖеÄÒ»¸ö©¶´Ê¹µÃ¸Ã»úÖÆÎÞ·¨Õý³£¹¤×÷¡£ÔÚ + Microsoft Internet Explorer 5 + ÖÐÕâ¸ö©¶´ÒÀÈ»´æÔÚ£¬Éý¼¶ Service Pack 2 ¼°ÆäÒÔºó°æ±¾ÖÐÕâ¸ö©¶´½«²»¸´´æÔÚ¡£ + </para> + </note> + <note> <simpara> Èç¹û PHP ÔËÐÐÔÚ°²È«Ä£Ê½ (<link linkend="ini.safe-mode">safe mode</link>) Ï£¬µ±Ç°Ê¹ÓÃÕߵıêʶºÅ (UID) »á¸½¼Óµ½Í·²¿ÐÅÏ¢ <literal>WWW-Authenticate</literal>