cvs: phpdoc-ja /reference/http reference.xml /reference/http/functions header.xml headers-list.xml headers-sent.xml setcookie.xml setrawcookie.xml
/reference/network/functions header.xml headers-list.xml headers-sent.xml setcookie.xml setrawcookie.xml
| From: | TAKAGI Masahiro | Date: | Thu, 27 Jul 2006 03:32:04 +0000 |
| Subject: | cvs: phpdoc-ja /reference/http reference.xml /reference/http/functions header.xml headers-list.xml headers-sent.xml setcookie.xml setrawcookie.xml /reference/network/functions header.xml headers-list.xml headers-sent.xml setcookie.xml setrawcookie.xml |
||
| Groups: | php.doc.ja | ||
| Request: | Send a blank email to doc-ja+get-1586@lists.php.net to get a copy of this message | ||
takagi Thu Jul 27 03:32:04 2006 UTC
Added files:
/phpdoc-ja/reference/network/functions setrawcookie.xml
setcookie.xml
headers-sent.xml
headers-list.xml header.xml
Removed files:
/phpdoc-ja/reference/http/functions setrawcookie.xml setcookie.xml
headers-sent.xml
headers-list.xml header.xml
Modified files:
/phpdoc-ja/reference/http reference.xml
Log:
sync with en.
http://cvs.php.net/viewvc.cgi/phpdoc-ja/reference/http/reference.xml?r1=1.5&r2=1.6&diff_format=u Index: phpdoc-ja/reference/http/reference.xml diff -u phpdoc-ja/reference/http/reference.xml:1.5 phpdoc-ja/reference/http/reference.xml:1.6 --- phpdoc-ja/reference/http/reference.xml:1.5 Mon Sep 5 11:34:06 2005 +++ phpdoc-ja/reference/http/reference.xml Thu Jul 27 03:32:04 2006 @@ -1,52 +1,183 @@ <?xml version="1.0" encoding="utf-8"?> -<!-- $Revision: 1.5 $ --> -<!-- EN-Revision: 1.8 Maintainer: hirokawa Status: ready --> -<!-- CREDITS: shimooka --> +<!-- $Revision: 1.6 $ --> +<!-- EN-Revision: 1.10 Maintainer: hirokawa Status: ready --> +<!-- CREDITS: shimooka,takagi --> <!-- Purpose: basic.php --> -<!-- Membership: core --> +<!-- Membership: pecl --> - <reference id="ref.http"> - <title>HTTP é¢é£ã®é¢æ°</title> - <titleabbrev>HTTP</titleabbrev> +<reference id="ref.http"> + <title>HTTP</title> + <titleabbrev>http</titleabbrev> - <partintro> - <section id="http.intro"> + <partintro> + <sect1 id="http.intro"> &reftitle.intro; - <para> - 以ä¸ã®é¢æ°ã¯ããªã¢ã¼ããã©ã¦ã¶ã«éãè¿ãããåºåããHTTPãããã³ã« - ã¬ãã«ã§å¶å¾¡ããããã®ãã®ã§ãã - </para> - </section> - - <section id="http.requirements"> - &reftitle.required; - &no.requirement; - </section> - - <section id="http.installation"> - &reftitle.install; - &no.install; - </section> - - <section id="http.configuration"> - &reftitle.runtime; - &no.config; - </section> - - <section id="http.resources"> - &reftitle.resources; - &no.resource; - </section> - - <section id="http.constants"> - &reftitle.constants; - &no.constants; - </section> - </partintro> + <simpara> + ãã® HTTP æ¡å¼µã¢ã¸ã¥ã¼ã«ã®çãã¯ãPHP + ã¢ããªã±ã¼ã·ã§ã³ã®ããã«ä¾¿å©ã§å¼·åãªæ©è½ãæä¾ãããã¨ã§ãã + </simpara> + <simpara> + HTTP ã® URLãæ¥ä»ããªãã¤ã¬ã¯ãããããããã³ã¡ãã»ã¼ã¸ã + 使ããããããã¯ã©ã¤ã¢ã³ãã®å¸æããè¨èªããã³æåã»ããã® + ãã´ã·ã¨ã¼ã·ã§ã³ææ®µãæä¾ãã¾ãã + ã¾ããä»»æã®ãã¼ã¿ãéä¿¡ããéã«ãã£ãã·ã¥ããªã¸ã¥ã¼ã ã®æ©è½ã + ãããããã¨ãã§ãã¾ãã + </simpara> + <simpara> + CURL ãµãã¼ãè¾¼ã¿ã§ãã«ãããã¦ããå ´åã¯ã + å¼·åãªãªã¯ã¨ã¹ãæ©è½ãæä¾ãã¾ããPHP 5 以éã§ã¯ã + è¤æ°ã®ãªã¯ã¨ã¹ããå¹³è¡ãã¦å®è¡ãããã¨ãã§ãã¾ãã + </simpara> + <simpara> + ãã®ããã¥ã¢ã«ã§ã¯ãAPI ãªãã¡ã¬ã³ã¹ã«å ã㦠+ ã¤ã³ã¹ãã¼ã«ãè¨å®ã®æ¹æ³ãå®ç¾©æ¸ã¿ã®ã°ãã¼ãã«å®æ°ãªã©ã + 以ä¸ã®ç¯ã§èª¬æãã¦ãã¾ãã + </simpara> + <simplelist> + <member><link linkend="http.install">ã¤ã³ã¹ãã¼ã«</link></member> + <member><link linkend="http.configuration">è¨å®</link></member> + <member><link linkend="http.constants">ã°ãã¼ãã«å®æ°</link></member> + </simplelist> + </sect1> + + <sect1> + <title>ã¯ã©ã¹</title> + <simplelist> + <member><link linkend="http.HttpMessage"><classname>HttpMessage</classname></link></member> + <member><link linkend="http.HttpQueryString"><classname>HttpQueryString</classname></link></member> + <member><link linkend="http.HttpDeflateStream"><classname>HttpDeflateStream</classname></link></member> + <member><link linkend="http.HttpInflateStream"><classname>HttpInflateStream</classname></link></member> + <member><link linkend="http.HttpRequest"><classname>HttpRequest</classname></link></member> + <member><link linkend="http.HttpRequestPool"><classname>HttpRequestPool</classname></link></member> + </simplelist> + </sect1> + + <sect1> + <title>颿°</title> + <sect2> + <title>çµã¿è¾¼ã¿ã®é¢æ°</title> + <simpara> + ãã®ãã¼ã¸ã§èª¬æãã¦ãã以å¤ã«ãçµã¿è¾¼ã¿ã® HTTP é¢é£é¢æ°ã + <link linkend="ref.network">ãããã¯ã¼ã¯é¢æ°</link> + ã«æãããã¦ãã¾ãã + </simpara> + <simpara> + 以ä¸ã®é¢æ°ã¯ãHTTP ã¢ã¸ã¥ã¼ã«ãå¿ è¦ã¨ãã¾ããã + <function>header</function>ã<function>headers_list</function>ã<function>headers_sent</function>ã + <function>setcookie</function> &listendand; <function>setrawcookie</function>ã + </simpara> + </sect2> + <sect2> + <title>ãã£ãã·ã¥</title> + <simplelist> + <member><link linkend="function.http-cache-etag"><function>http_cache_etag</function></link></member> + <member><link linkend="function.http-cache-last-modified"><function>http_cache_last_modified</function></link></member> + </simplelist> + </sect2> + <sect2> + <title>ã¨ã³ã³ã¼ãã£ã³ã°</title> + <simplelist> + <member><link linkend="function.http-chunked-decode"><function>http_chunked_decode</function></link></member> + <member><link linkend="function.http-deflate"><function>http_deflate</function></link></member> + <member><link linkend="function.http-inflate"><function>http_inflate</function></link></member> + </simplelist> + </sect2> + <sect2> + <title>éå¤ãªé¢æ°</title> + <simplelist> + <member><link linkend="function.http-build-cookie"><function>http_build_cookie</function></link></member> + <member><link linkend="function.http-date"><function>http_date</function></link></member> + <member><link linkend="function.http-get-request-body-stream"><function>http_get_request_body_stream</function></link></member> + <member><link linkend="function.http-get-request-body"><function>http_get_request_body</function></link></member> + <member><link linkend="function.http-get-request-headers"><function>http_get_request_headers</function></link></member> + <member><link linkend="function.http-match-etag"><function>http_match_etag</function></link></member> + <member><link linkend="function.http-match-modified"><function>http_match_modified</function></link></member> + <member><link linkend="function.http-match-request-header"><function>http_match_request_header</function></link></member> + <member><link linkend="function.http-support"><function>http_support</function></link></member> + </simplelist> + </sect2> + <sect2> + <title>ãã´ã·ã¨ã¼ã·ã§ã³</title> + <simplelist> + <member><link linkend="function.http-negotiate-charset"><function>http_negotiate_charset</function></link></member> + <member><link linkend="function.http-negotiate-ctype"><function>http_negotiate_ctype</function></link></member> + <member><link linkend="function.http-negotiate-language"><function>http_negotiate_language</function></link></member> + </simplelist> + </sect2> + <sect2> + <title>åºåãã³ãã©</title> + <simplelist> + <member><link linkend="function.ob-deflatehandler"><function>ob_deflatehandler</function></link></member> + <member><link linkend="function.ob-etaghandler"><function>ob_etaghandler</function></link></member> + <member><link linkend="function.ob-inflatehandler"><function>ob_inflatehandler</function></link></member> + </simplelist> + </sect2> + <sect2> + <title>ãã¼ãµ</title> + <simplelist> + <member><link linkend="function.http-parse-cookie"><function>http_parse_cookie</function></link></member> + <member><link linkend="function.http-parse-headers"><function>http_parse_headers</function></link></member> + <member><link linkend="function.http-parse-message"><function>http_parse_message</function></link></member> + <member><link linkend="function.http-parse-params"><function>http_parse_params</function></link></member> + </simplelist> + </sect2> + <sect2> + <title>ãªã¯ã¨ã¹ã</title> + <simplelist> + <member><link linkend="function.http-get"><function>http_get</function></link></member> + <member><link linkend="function.http-head"><function>http_head</function></link></member> + <member><link linkend="function.http-post-data"><function>http_post_data</function></link></member> + <member><link linkend="function.http-post-fields"><function>http_post_fields</function></link></member> + <member><link linkend="function.http-put-data"><function>http_put_data</function></link></member> + <member><link linkend="function.http-put-file"><function>http_put_file</function></link></member> + <member><link linkend="function.http-put-stream"><function>http_put_stream</function></link></member> + <member><link linkend="function.http-request-body-encode"><function>http_request_body_encode</function></link></member> + <member><link linkend="function.http-request-method-exists"><function>http_request_method_exists</function></link></member> + <member><link linkend="function.http-request-method-name"><function>http_request_method_name</function></link></member> + <member><link linkend="function.http-request-method-register"><function>http_request_method_register</function></link></member> + <member><link linkend="function.http-request-method-unregister"><function>http_request_method_unregister</function></link></member> + <member><link linkend="function.http-request"><function>http_request</function></link></member> + </simplelist> + </sect2> + <sect2> + <title>ã¬ã¹ãã³ã¹</title> + <simplelist> + <member><link linkend="function.http-redirect"><function>http_redirect</function></link></member> + <member><link linkend="function.http-send-content-disposition"><function>http_send_content_disposition</function></link></member> + <member><link linkend="function.http-send-content-type"><function>http_send_content_type</function></link></member> + <member><link linkend="function.http-send-data"><function>http_send_data</function></link></member> + <member><link linkend="function.http-send-file"><function>http_send_file</function></link></member> + <member><link linkend="function.http-send-last-modified"><function>http_send_last_modified</function></link></member> + <member><link linkend="function.http-send-status"><function>http_send_status</function></link></member> + <member><link linkend="function.http-send-stream"><function>http_send_stream</function></link></member> + <member><link linkend="function.http-throttle"><function>http_throttle</function></link></member> + </simplelist> + </sect2> + <sect2> + <title>URL</title> + <simplelist> + <member><link linkend="function.http-build-str"><function>http_build_str</function></link></member> + <member><link linkend="function.http-build-url"><function>http_build_url</function></link></member> + </simplelist> + </sect2> + </sect1> + + </partintro> + + &reference.http.install; + &reference.http.configuration; + &reference.http.constants; + &reference.http.HttpMessage; + &reference.http.HttpQueryString; + &reference.http.HttpDeflateStream; + &reference.http.HttpInflateStream; + &reference.http.HttpRequest; + &reference.http.HttpRequestPool; + &reference.http.HttpResponse; + &reference.http.functions; -&reference.http.functions; +</reference> - </reference> <!-- Keep this comment at the end of the file Local variables: mode: sgml @@ -67,4 +198,3 @@ vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> - http://cvs.php.net/viewvc.cgi/phpdoc-ja/reference/network/functions/setrawcookie.xml?view=markup&rev=1.1 Index: phpdoc-ja/reference/network/functions/setrawcookie.xml +++ phpdoc-ja/reference/network/functions/setrawcookie.xml <?xml version="1.0" encoding="utf-8"?> <!-- $Revision: 1.1 $ --> <!-- EN-Revision: 1.1 Maintainer: takagi Status: ready --> <refentry id="function.setrawcookie"> <refnamediv> <refname>setrawcookie</refname> <refpurpose>å¤ã URL ã¨ã³ã³ã¼ãããã«ã¯ããã¼ãéä¿¡ãã</refpurpose> </refnamediv> <refsect1> <title>説æ</title> <methodsynopsis> <type>bool</type><methodname>setrawcookie</methodname> <methodparam><type>string</type><parameter>name</parameter></methodparam> <methodparam choice="opt"><type>string</type><parameter>value</parameter></methodparam> <methodparam choice="opt"><type>int</type><parameter>expire</parameter></methodparam> <methodparam choice="opt"><type>string</type><parameter>path</parameter></methodparam> <methodparam choice="opt"><type>string</type><parameter>domain</parameter></methodparam> <methodparam choice="opt"><type>bool</type><parameter>secure</parameter></methodparam> </methodsynopsis> <para> <function>setrawcookie</function> ã¯ã ãã©ã¦ã¶ã«éä¿¡ãããéã¯ããã¼ã®å¤ãèªåçã« URL ã¨ã³ã³ã¼ããããªããã¨ãé¤ãã <function>setcookie</function> ã¨ç価ã§ãã </para> <para> <function>header</function>ã<function>setcookie</function> ããã³ <link linkend="features.cookies">ã¯ããã¼ã®ã»ã¯ã·ã§ã³</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-ja/reference/network/functions/setcookie.xml?view=markup&rev=1.1 Index: phpdoc-ja/reference/network/functions/setcookie.xml +++ phpdoc-ja/reference/network/functions/setcookie.xml <?xml version="1.0" encoding="utf-8"?> <!-- $Revision: 1.1 $ --> <!-- EN-Revision: 1.1 Maintainer: takagi Status: ready --> <refentry id="function.setcookie"> <refnamediv> <refname>setcookie</refname> <refpurpose>ã¯ããã¼ãéä¿¡ãã</refpurpose> </refnamediv> <refsect1> <title>説æ</title> <methodsynopsis> <type>bool</type><methodname>setcookie</methodname> <methodparam><type>string</type><parameter>name</parameter></methodparam> <methodparam choice="opt"><type>string</type><parameter>value</parameter></methodparam> <methodparam choice="opt"><type>int</type><parameter>expire</parameter></methodparam> <methodparam choice="opt"><type>string</type><parameter>path</parameter></methodparam> <methodparam choice="opt"><type>string</type><parameter>domain</parameter></methodparam> <methodparam choice="opt"><type>bool</type><parameter>secure</parameter></methodparam> </methodsynopsis> <para> <function>setcookie</function> ã¯ããã®ä»ã®ãããæ å ±ã¨å ±ã« éä¿¡ããã¯ããã¼ãå®ç¾©ãã¾ãã ã»ãã®ãããæ å ±ã¨åæ§ã«ã ã¯ããã¼ã¯ãã¹ã¯ãªããã«ããä»ã®ããããåºåããã<emphasis>åã«</emphasis> éä¿¡ãããå¿ è¦ãããã¾ãï¼ããã¯HTTPãããã³ã«ã®å¶ç´ã§ãï¼ã <literal><html></literal> ã <literal><head></literal> ã¿ã°ã¯ãã¡ãã 空ç½ãå«ããããããåºåãããåã«ãã®é¢æ°ãã³ã¼ã«ããããã«ããªããã°ãªãã¾ããã ããããã®é¢æ°ãã³ã¼ã«ããåã«ä½ããã®åºåãããå ´åã«ã¯ã <function>setcookie</function> ã¯å¤±æã &false; ãè¿ãã¾ãã <function>setcookie</function> ãæ£å¸¸ã«å®è¡ãããã¨ã&true; ãè¿ãã¾ãã ãã®é¢æ°ã¯ã¦ã¼ã¶ã¼ãã¯ããã¼ãåãå ¥ãããã©ããã示ããã¨ã¯ãã¾ããã </para> <note> <para> PHP 4 ã§ã¯ããã®é¢æ°ãã³ã¼ã«ããåã§ãåºåã§ããããã«ã ã¹ã¯ãªããã®å ¨ã¦ã®åºåããµã¼ãå ã«ãããã¡ãªã³ã°ããããã¨ãã§ãã¾ãã ãã®ããã«ã¯ã<function>ob_start</function> ã <function>ob_end_flush</function> ã使ç¨ããããããã㯠&php.ini; ã® <literal>output_buffering</literal> è¨å®ã使ç¨ãã¾ãã </para> </note> <para> <parameter>name</parameter> 以å¤ã®å ¨ã¦ã®å¼æ°ã¯ãªãã·ã§ã³ã§ãã å ¨ã¦ã®å¼æ°ã«é¢ãã¦å¼æ°ã®æå®ãã¹ãããããããã«ç©ºæåå (<emphasis>""</emphasis>) ã¨ãããã¨ãå¯è½ã§ãã <parameter>expire</parameter> ããã³ <parameter>secure</parameter> ã¯æ°å¤ãªã®ã§ã空æååã§ã¹ããããããã¨ã¯ã§ãã¾ããã代ããã«ã¼ã (<emphasis>0</emphasis>) ã使ç¨ãã¦ãã ããã 以ä¸ã®è¡¨ã¯ <function>setcookie</function> ã®å¼æ°ã®èª¬æã§ãã <function>setcookie</function> 颿°ã®å弿°ã ã©ã®ããã«ä½ç¨ããããç¥ãã«ã¯ <ulink url="&spec.cookies;">Netscape cookie specification</ulink> ãããã㦠HTTP ã¯ããã¼ã®åä½ã«ã¤ãã¦ã®è©³ç´°ãªæ å ±ã¯ ã¨<ulink url="&url.rfc;2965">RFC 2965</ulink> ãåç §ãã ããã </para> <para> <table> <title><function>setcookie</function> 弿°ã®èª¬æ</title> <tgroup cols="3"> <thead> <row> <entry>弿°</entry> <entry>説æ</entry> <entry>ä¾</entry> </row> </thead> <tbody> <row> <entry><parameter>name</parameter></entry> <entry> ã¯ããã¼ã®åå </entry> <entry> 'cookiename' ã <varname>$_COOKIE['cookiename'] ã¨ãã¦ã³ã¼ã«ããã¾ãã</varname> </entry> </row> <row> <entry><parameter>value</parameter></entry> <entry> ã¯ããã¼ã®å¤ããã®å¤ã¯ã¯ã©ã¤ã¢ã³ãã®ã³ã³ãã¥ã¼ã¿ã«ä¿åããã¾ãã®ã§ã éè¦ãªæ å ±ã¯æ ¼ç´ããªãã§ãã ããã </entry> <entry> <parameter>name</parameter> ã 'cookiename' ã ã¨ããã¨ã ãã®å¤ã¯ <varname>$_COOKIE['cookiename']</varname> ã§åå¾ãããã¨ãã§ãã¾ãã </entry> </row> <row> <entry><parameter>expire</parameter></entry> <entry> ã¯ããã¼ã®æå¹æéããã㯠Unix ã¿ã¤ã ã¹ã¿ã³ããªã®ã§ Epochï¼1970 å¹´ 1 æ 1 æ¥ï¼ããã®çµéç§æ°ã¨ãªãã¾ãã <function>time</function> ã¾ã㯠<function>mktime</function> 颿°ã«ãã è¿ãããç¾å¨ã®UNIXæ¨æºæã«ãæéã¨ãããå¿ è¦ãªç§æ°ãå ç®ãããã®ã å©ç¨ãããã¨ãã§ããã§ãããã </entry> <entry> <literal>time()+60*60*24*30</literal> ã¯ã¯ããã¼ã®æå¹æéã 30 æ¥å¾ã«ã»ãããã¾ãã ãããè¨å®ããªãå ´åãã¯ããã¼ã¯ã»ãã·ã§ã³ã®æå¾ (ã¤ã¾ããã©ã¦ã¶ãéããã¨ã) ãæå¹æéã¨ãªãã¾ãã </entry> </row> <row> <entry><parameter>path</parameter></entry> <entry> ãµã¼ãã¼ä¸ã§ã®ãã¯ããã¼ãæå¹ã¨ããããã¹ </entry> <entry> <literal>'/'</literal> ãã»ããããã¨ãã¯ããã¼ã¯ <parameter>domain</parameter> é ä¸ã®å ¨ã¦ã§æå¹ã¨ãªãã¾ãã <literal>'/foo/'</literal> ãã»ããããã¨ãã¯ããã¼ã¯ <literal>/foo/</literal> ãã£ã¬ã¯ããªã¨ãã®ãµããã£ã¬ã¯ããªé ä¸ (ä¾ãã° <literal>/foo/bar/</literal>) ã§æå¹ã¨ãªãã¾ãã ããã©ã«ãå¤ã¯ãã¯ããã¼ãã»ãããããã¨ãã®ã«ã¬ã³ããã£ã¬ã¯ããªã§ãã </entry> </row> <row> <entry><parameter>domain</parameter></entry> <entry> ã¯ããã¼ãæå¹ãªãã¡ã¤ã³ </entry> <entry> exapmle.com ã®å ¨ã¦ã®ãµããã¡ã¤ã³ã§ã¯ããã¼ãæå¹ã¨ããã«ã¯ <literal>'.example.com'</literal> ãã»ãããã¾ãã <literal>.</literal> ã¯å¿ é ã§ã¯ããã¾ãããã å¤ãã®ãã©ã¦ã¶ã«ããã¦äºææ§ãããã¾ãã <literal>www.example.com</literal> ã«ã»ããããã¨ã ã¯ããã¼ã¯<literal>www</literal> ãµããã¡ã¤ã³ã«ããã¦ã®ã¿æå¹ã¨ãªãã¾ãã æ«å°¾ã®ãããã³ã°ã«ã¤ãã¦ã®è©³ç´°ã¯ <ulink url="&spec.cookies;">仿§</ulink> ãã覧ãã ããã </entry> </row> <row> <entry><parameter>secure</parameter></entry> <entry> ã»ãã¥ã¢ãª HTTPS æ¥ç¶ã®å ´åã«ã®ã¿ã¯ããã¼ãéä¿¡ãããããã«ãã¾ãã &true; ãè¨å®ããã¨ãã»ãã¥ã¢ãªæ¥ç¶ãåå¨ããå ´åã«ã®ã¿ã¯ããã¼ã è¨å®ãã¾ããããã©ã«ã㯠&false; ã§ãã </entry> <entry> <literal>0</literal> ã¾ã㯠<literal>1</literal> </entry> </row> </tbody> </tgroup> </table> </para> <para> ä¸åº¦ã¯ããã¼ãéä¿¡ãããã¨ã次ã®ãã¼ã¸ã®ãã¼ããã㯠<link linkend="reserved.variables.cookies">$_COOKIE</link> ã <varname>$HTTP_COOKIE_VARS</varname> é åã«ãã£ã¦ã¯ããã¼ã«ã¢ã¯ã»ã¹ã§ãã¾ãã <varname>$_COOKIE</varname> ã®ãã㪠<link linkend="language.variables.superglobals">autoglobals</link> 㯠<ulink url="&url.php.release4.1.0;">4.1.0</ulink> 以éã§æå¹ã¨ãªããã¨ã«æ³¨æãã¦ãã ããã <varname>$HTTP_COOKIE_VARS</varname> 㯠PHP 3 以éã§ä½¿ç¨ã§ãã¾ãã ã¯ããã¼ã®å¤ã¯ <link linkend="reserved.variables.request">$_REQUEST</link> é åãããã¢ã¯ã»ã¹ã§ãã¾ãã </para> <note> <para> PHPã® <link linkend="ini.register-globals">register_globals</link> ãã£ã¬ã¯ãã£ãã <literal>on</literal> ã«ãªã£ã¦ããå ´åã ã¯ããã¼ã¯å¤æ°ã«ãç»é²ããã¦ãã¾ãã 以ä¸ã®ä¾ã§ã¯ã<varname>$TestCookie</varname> 夿°ãåå¨ãã¾ãã <varname>$_COOKIE</varname> ã®ä½¿ç¨ãæ¨å¥¨ããã¾ãã </para> </note> <para> é¥ãããã失æ <itemizedlist> <listitem> <simpara> ã¯ããã¼ã¯ãã¯ããã¼ãæå¹ã«ããããã«æ¬¡ã«ãã¼ã¸ããã¼ãããã¾ã§ ã¢ã¯ã»ã¹ãããã¨ãã§ãã¾ãããã¯ããã¼ãæ£å¸¸ã«ã»ãããããã ãã¹ãããããã«ãã¯ããã¼ã®æå¹æéãåããåã«æ¬¡ã®ãã¼ã¸ã ãã¼ããã¦ã¯ããã¼ããã§ãã¯ãã¦ãã ããã æå¹æé㯠<parameter>expire</parameter> 弿°ã§ã»ããããã¾ãã ã¯ããã¼ã®å©ç¨ã«ã¤ãã¦ãããã°ããã®ã«è¯ãæ¹æ³ã¯ <literal>print_r($_COOKIE);</literal> ãã³ã¼ã«ãããã¨ã§ãã </simpara> </listitem> <listitem> <simpara> ã¯ããã¼ã¯è¨å®ããããã®ã¨åããã©ã¡ã¼ã¿ã§åé¤ããå¿ è¦ãããã¾ãã å¤ã空æåå ("") ã§ããã®ä»ã®å ¨ã¦ã®å¼æ°ãåã« setcookie ãã³ã¼ã«ããæã¨åãã§ããå ´åã«ãæå®ãããååã®ã¯ããã¼ã ãªã¢ã¼ãã¯ã©ã¤ã¢ã³ãä¸ããåé¤ããã¾ãã </simpara> </listitem> <listitem> <simpara> ã¯ããã¼ã®å¤ã¨ã㦠&false; ãè¨å®ããã¨ãã¯ããã¼ãåé¤ãããã¨ãã¾ãã ãã®ãããboolean å¤ã¯ä½¿ç¨ã§ãã¾ããããã®ä»£ããã¨ãã¦ã &false; ã§ã¯ãªã <emphasis>0</emphasis>ããã㦠&true; ã§ã¯ãªã <emphasis>1</emphasis> ã使ç¨ãã¾ãã </simpara> </listitem> <listitem> <simpara> ã¯ããã¼åã§é åãè¨è¿°ãããã¨ã«ããã ã¯ããã¼ã®é åãè¨å®ãããã¨ãå¯è½ã§ãããè¤æ°ã®ã¯ããã¼ ãã¦ã¼ã¶ã¼ã®ã·ã¹ãã ä¸ã«ä¿åããããã¨ã«ãªãã¾ãã <function>explode</function> ã使ç¨ã㦠ã²ã¨ã¤ã®ã¯ããã¼ä¸ã«è¤æ°ã®ååã¨å¤ãã»ãããããã¨ã èæ ®ãã¦ãã ããã<function>serialize</function> ã®ä½¿ç¨ã¯ã»ãã¥ãªãã£ã¼ãã¼ã«ã«ãªãå¾ãããã ãã®ç®çã®ããã«ä½¿ç¨ãããã¨ã¯æ¨å¥¨ããã¾ããã </simpara> </listitem> </itemizedlist> </para> <simpara> PHP 3 ã«ããã¦åãã¹ã¯ãªããã§ <function>setcookie</function> ãè¤æ°åã³ã¼ã«ããå ´åãéã®é çªã§å®è¡ããã¾ãã ä»ã®ã¯ããã¼ãæ¿å ¥ããåã«ããã¯ããã¼ãåé¤ãããã¨ããå ´åã åé¤ããåã«æ¿å ¥ãè¡ãå¿ è¦ãããã¾ããPHP 4 ã§ã¯ã <function>setcookie</function> ãè¤æ°åã³ã¼ã«ããå ´åã§ãã³ã¼ã«ããé çªã§å®è¡ããã¾ãã </simpara> <para> 以ä¸ã¯ã¯ããã¼ãéä¿¡ããä¾ã§ãã <example> <title><function>setcookie</function> ã«ããéä¿¡ã®ãµã³ãã«</title> <programlisting role="php"> <![CDATA[ <?php $value = 'something from somewhere'; setcookie("TestCookie", $value); setcookie("TestCookie", $value, time()+3600); /* æå¹æéã¯ä¸æéã§ã */ setcookie("TestCookie", $value, time()+3600, "/~rasmus/", ".example.com", 1); ?> ]]> </programlisting> </example> </para> <para> ã¯ããã¼ã® value ã®é¨åã¯ãã¯ããã¼ã®éä¿¡ãè¡ãéã«èªåçã« URL ã¨ã³ã³ã¼ããããã¾ãã¯ããã¼ãåä¿¡ããéã¯ãèªåçã«ãã³ã¼ã ããã¦ã¯ããã¼åã¨åãååã®å¤æ°ã«æ ¼ç´ããããã¨ã«æ³¨æãã¦ãã ããã ãã®æåãæ°ã«å ¥ããªãå ´åããã PHP 5 ã使ç¨ãã¦ãããªã 代ããã« <function>setrawcookie</function> ã使ã£ã¦ãã ããã ã¹ã¯ãªããå é¨ã§ TestCookie ã®å 容ãè¦ããå ´åã¯ã 以ä¸ã®ããããã®ä¾ã使ç¨ãã¾ãã </para> <para> <informalexample> <programlisting role="php"> <![CDATA[ <?php // åã ã®ã¯ããã¼ã表示ãã¾ã echo $_COOKIE["TestCookie"]; echo $HTTP_COOKIE_VARS["TestCookie"]; // ãããã°ï¼ãã¹ãç¨ã«ã¯ãå ¨ã¦ã®ã¯ããã¼ãè¦ãæ¹æ³ãããã¾ãã print_r($_COOKIE); ?> ]]> </programlisting> </informalexample> </para> <para> ã¯ããã¼ãåé¤ããå ´åã«ã¯ããã©ã¦ã¶ã®å餿©æ§ãèµ·åããããã« å¿ ãæå¹æéãéå»ã«è¨å®ããå¿ è¦ãããã¾ãã æ¬¡ã«ãå ã»ã©ä¾ã§éä¿¡ããã¯ããã¼ãåé¤ããä¾ã示ãã¾ãã </para> <para> <example> <title><function>setcookie</function> ã«ããåé¤ã®ä¾</title> <programlisting role="php"> <![CDATA[ <?php // æå¹æéã䏿éåã«è¨å®ãã¾ã setcookie ("TestCookie", "", time() - 3600); setcookie ("TestCookie", "", time() - 3600, "/~rasmus/", ".example.com", 1); ?> ]]> </programlisting> </example> </para> <para> ã¯ããã¼åã§é åãè¨è¿°ãããã¨ã«ãããã¯ããã¼ã®é åãè¨å®ãããã¨ãå¯è½ã§ãã ããã«ããé åè¦ç´ ã¨åæ°ã®ã¯ããã¼ãè¨å®ããã¾ããã ã¯ããã¼ãã¹ã¯ãªããã«åä¿¡ãããéã«ã å¤ã¯ã¯ããã¼åãæããé åã«ç½®ãããããã¾ãã </para> <para> <example> <title><function>setcookie</function> ã¨é å</title> <programlisting role="php"> <![CDATA[ <?php // ã¯ããã¼ãè¨å®ãã¾ã setcookie("cookie[three]", "cookiethree"); setcookie("cookie[two]", "cookietwo"); setcookie("cookie[one]", "cookieone"); // ãã¼ã¸ãåèªã¿è¾¼ã¿ããå¾ã«ã表示ãã¾ã if (isset($_COOKIE['cookie'])) { foreach ($_COOKIE['cookie'] as $name => $value) { echo "$name : $value <br />\n"; } } ?> ]]> </programlisting> <para> ãã®çµæã¯ã次ã®ããã«ãªãã¾ãã </para> <screen> <![CDATA[ three : cookiethree two : cookietwo one : cookieone ]]> </screen> </example> </para> <note> <para> <ulink url="&url.rfc;2109">RFC 2109</ulink> ããã³ <ulink url="&url.rfc;2965">RFC 2695</ulink> ãåèã«ãªãã§ãããã </para> <para> <parameter>expire</parameter> ãã©ã¡ã¼ã¿ã«ã¯ã<literal>Wdy, DD-Mon-YYYY HH:MM:SS GMT</literal> ã¨ãã£ãå½¢å¼ã§ã¯ãªã Unix ã¿ã¤ã ã¹ã¿ã³ããæ¸¡ãã¦ãããã¨ã«ãæ°ã¥ãã§ããããã ããã¯ãPHP ã®å é¨ã§èªåçã«å¤æãè¡ã£ã¦ããããã§ãã </para> <para> <parameter>expire</parameter> ã¯ãã¯ã©ã¤ã¢ã³ãã®æå»ã¨æ¯è¼ããã¾ãã ãµã¼ãã®æå»ã¨ã®æ¯è¼ã§ã¯ããã¾ããã </para> </note> <note> <simpara> ãµã¼ãã¹ãã㯠1 ãé©ç¨ãã Microsoft Internet Explorer 4 ã¯ã ãã¹ã«é¢ãããã©ã¡ã¼ã¿ãè¨å®ããã¯ããã¼ãæ£ç¢ºã«å¦çãããã¨ãã§ãã¾ããã </simpara> <simpara> Netscape Communicator 4.05 ããã³ Microsoft Internet Explorer 3.x ã¯ãpath 㨠time ãè¨å®ããã¦ããªãå ´åã ã¯ããã¼ãæ£ç¢ºã«å¦çãããã¨ãã§ããªãããã§ãã </simpara> </note> <para> <function>header</function>ã<function>setrawcookie</function> ããã³<link linkend="features.cookies">ã¯ããã¼ã®ã»ã¯ã·ã§ã³</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-ja/reference/network/functions/headers-sent.xml?view=markup&rev=1.1 Index: phpdoc-ja/reference/network/functions/headers-sent.xml +++ phpdoc-ja/reference/network/functions/headers-sent.xml <?xml version="1.0" encoding="utf-8"?> <!-- $Revision: 1.1 $ --> <!-- EN-Revision: 1.1 Maintainer: takagi Status: ready --> <refentry id="function.headers-sent"> <refnamediv> <refname>headers_sent</refname> <refpurpose>ããããæ¢ã«éä¿¡ããã¦ãããã©ããã調ã¹ã</refpurpose> </refnamediv> <refsect1> <title>説æ</title> <methodsynopsis> <type>bool</type><methodname>headers_sent</methodname> <methodparam choice="opt"><type>string</type><parameter role="reference">file</parameter></methodparam> <methodparam choice="opt"><type>int</type><parameter role="reference">line</parameter></methodparam> </methodsynopsis> <simpara> <function>headers_sent</function> ã¯ãHTTP ããããæ¢ã«éä¿¡ããã¦ããå ´åã« &true; ãããã§ãªãå ´åã« &false; ãè¿ãã¾ãã ã¾ãããªãã·ã§ã³å¼æ°ã® <parameter>file</parameter> 㨠<parameter>line</parameter> ãã»ããããã¦ããå ´åã PHP ã®ã½ã¼ã¹ãã¡ã¤ã«åã¨åºåãéå§ãããè¡çªå·ãããããã <parameter>file</parameter> 㨠<parameter>line</parameter> ã«æ ¼ç´ããã¾ãã </simpara> <simpara> ããããããã¯ããã£ããéä¿¡ããã¦ãã¾ã£ãå¾ã§ <function>header</function> 颿°ã使ã£ã¦æ°ããªãããè¡ãéä¿¡ãããã¨ã¯ã§ãã¾ããã ãã®é¢æ°ã使ãã«ã¯ãå°ãªãã¨ã HTTP ãããé¢é£ã®ã¨ã©ã¼ãäºé²ããå¿ è¦ãããã¾ãã ãããã¯ã<link linkend="ref.outcontrol">åºåãããã¡ãªã³ã°</link>ã ä½¿ãæ¹æ³ãããã¾ãã </simpara> <note> <simpara> ãªãã·ã§ã³ã®ãã©ã¡ã¼ã¿ <parameter>file</parameter> 㨠<parameter>line</parameter> ã PHP 4.3.0 ã§è¿½å ããã¾ããã </simpara> </note> <para> <example> <title><function>headers_sent</function> 颿°ã®ä½¿ç¨ä¾</title> <programlisting role="php"> <![CDATA[ <?php // ããããã¾ã ä½ãéä¿¡ããã¦ããªãå ´åã«ãéä¿¡ãã¾ã if (!headers_sent()) { header('Location: http://www.example.com/'); exit; } // ãªãã·ã§ã³ã®fileã¨lineãã©ã¡ã¼ã¿ã®ä½¿ç¨ä¾ï¼PHP4.3.0以éï¼ // $filename 㨠$linenum ãå¾ã§ä½¿ç¨ããã¦ãããã¨ã«æ³¨ç®ã // ãããã®å¤æ°ã«äºåã«å¤ãä¸ããããã¦ã¯ããã¾ããã if (!headers_sent($filename, $linenum)) { header('Location: http://www.example.com/'); exit; // ãããããããã§ã¨ã©ã¼å¦çãè¡ãã§ãããã } else { echo "$filename ã® $linenum è¡ç®ã§ãããããã§ã«éä¿¡ããã¦ãã¾ãã\n" . "ãªãã¤ã¬ã¯ãã§ãã¾ããã代ããã«ãã® <a " . "href=\"http://www.example.com\">ãªã³ã¯</a> ãã¯ãªãã¯ãã¦ãã ããã\n"; exit; } ?> ]]> </programlisting> </example> </para> <para> ããã«é¢é£ãããã詳細ãªè°è«ã¯ <function>ob_start</function>ã <function>trigger_error</function>ã <function>header</function> ãåç §ãã ããã </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-ja/reference/network/functions/headers-list.xml?view=markup&rev=1.1 Index: phpdoc-ja/reference/network/functions/headers-list.xml +++ phpdoc-ja/reference/network/functions/headers-list.xml <?xml version="1.0" encoding="utf-8"?> <!-- $Revision: 1.1 $ --> <!-- EN-Revision: 1.1 Maintainer: takagi Status: ready --> <refentry id="function.headers-list"> <refnamediv> <refname>headers_list</refname> <refpurpose>éä¿¡ãã (ãããã¯éä¿¡ãããäºå®ã®) ã¬ã¹ãã³ã¹ãããã®ä¸è¦§ãè¿ã</refpurpose> </refnamediv> <refsect1> <title>説æ</title> <methodsynopsis> <type>array</type><methodname>headers_list</methodname> <void/> </methodsynopsis> <simpara> <function>headers_list</function> ã¯ãã©ã¦ã¶ãããã¯ã¯ã©ã¤ã¢ã³ãã«éä¿¡ããããããã®æ°å¤é åãè¿ãã¾ãã ãããã®ããããéä¿¡ããããã©ããã夿ããããã«ã¯ <function>headers_sent</function> ã使ç¨ãã¾ãã </simpara> <para> <example> <title><function>headers_list</function> ã®ä½¿ç¨ä¾</title> <programlisting role="php"> <![CDATA[ <?php /* setcookie() ã§ã¬ã¹ãã³ã¹ããããããèªèº«ã«è¿½å ãã¾ã */ setcookie('foo', 'bar'); /* ç¬èªã®ã¬ã¹ãã³ã¹ããããå®ç¾©ãã¾ãã ããã¯ã»ã¨ãã©ã®ã¯ã©ã¤ã¢ã³ãã§ç¡è¦ããã */ header("X-Sample-Test: foo"); /* ã¬ã¹ãã³ã¹ããã¬ã¼ã³ããã¹ãã ã¨å®£è¨ãã¾ã */ header('Content-type: text/plain'); /* éä¿¡ãããã¨ãã¦ãããããã¯? */ var_dump(headers_list()); ?> ]]> </programlisting> <para> ãã®åºåã¯æ¬¡ã®éãã§ãã </para> <screen> <![CDATA[ array(4) { [0]=> string(23) "X-Powered-By: PHP/5.1.3" [1]=> string(19) "Set-Cookie: foo=bar" [2]=> string(18) "X-Sample-Test: foo" [3]=> string(24) "Content-type: text/plain" } ]]> </screen> </example> </para> <simpara> <function>headers_sent</function>ã <function>header</function> ããã³ <function>setcookie</function> ãåç §ãã ããã </simpara> </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-ja/reference/network/functions/header.xml?view=markup&rev=1.1 Index: phpdoc-ja/reference/network/functions/header.xml +++ phpdoc-ja/reference/network/functions/header.xml <?xml version="1.0" encoding="utf-8"?> <!-- $Revision: 1.1 $ --> <!-- EN-Revision: 1.1 Maintainer: takagi Status: ready --> <refentry id="function.header"> <refnamediv> <refname>header</refname> <refpurpose>çã® HTTP ããããéä¿¡ãã</refpurpose> </refnamediv> <refsect1> <title>説æ</title> <methodsynopsis> <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_response_code</parameter></methodparam> </methodsynopsis> <para> <function>header</function> ã¯ãçã® <acronym>HTTP</acronym> ããããéä¿¡ããããã«ä½¿ç¨ããã¾ãã <acronym>HTTP</acronym> ãããã«ã¤ãã¦ã®è©³ç´°ãªæ å ±ã¯ <ulink url="&url.rfc;2616">HTTP/1.1 仿§</ulink> ãåç §ãã ããã </para> <note> <para> PHP 4.4.2 ããã³ PHP 5.1.2 以éããã®é¢æ°ã¯ä¸åº¦ã«è¤æ°ã®ãããã éä¿¡ã§ããªãããã«ãªãã¾ãããããã¯ã ãããã¤ã³ã¸ã§ã¯ã·ã§ã³æ»æã¸ã®å¯¾çã§ãã </para> </note> <para> ãªãã·ã§ã³ã®ãã©ã¡ã¼ã¿ <parameter>replace</parameter> ã¯ããããã åã«éä¿¡ãããé¡ä¼¼ã®ããããç½®æããããã¾ãã¯ãåãå½¢å¼ã®äºçªç®ã® ãããã追å ãããã©ãããæå®ãã¾ããããã©ã«ãã§ã¯ããã®é¢æ°ã¯ ç½®æãè¡ãªãã¾ãããäºçªç®ã®å¼æ°ã« &false; ãæå®ããã¨ãåãåã® è¤æ°ã®ããããå¼·å¶çã«çæãã¾ããä¾ãã°ã </para> <para> <informalexample> <programlisting role="php"> <![CDATA[ <?php header('WWW-Authenticate: Negotiate'); header('WWW-Authenticate: NTLM', false); ?> ]]> </programlisting> </informalexample> </para> <para> 第äºãªãã·ã§ã³å¼æ° <parameter>http_response_code</parameter> 㯠HTTP ã¬ã¹ãã³ã¹ã³ã¼ããå¼·å¶çã«æå®ã®å¤ã«ãã¾ã (ãã®ãã©ã¡ã¼ã¿ã¯ PHP 4.3.0 以éã§æå¹ã§ã)ã </para> <para> ç¹æ®ãª header ã³ã¼ã«ã 2 種é¡ããã¾ããæåã®ãã®ã¯ã æåå "<literal>HTTP/</literal>" ããå§ã¾ãå ¨ã¦ã®ããã (大æåã»å°æåã¯åºå¥ããã¾ãã) ã§ãã ãã®ãããã¯ãéä¿¡ãã HTTP ã¹ãã¼ã¿ã¹ã³ã¼ãã示ãããã«ä½¿ç¨ããã¾ãã ä¾ãã°ãåå¨ããªããã¡ã¤ã«ã¸ã®ãªã¯ã¨ã¹ããå¦çããããã«ãã PHP ã¹ã¯ãªããã使ç¨ãããã (<literal>ErrorDocument</literal> ãã£ã¬ã¯ãã£ãã«ãã) Apache ãè¨å®ããå ´åã ãã®ã¹ã¯ãªãããæ£ããã¹ãã¼ã¿ã¹ã³ã¼ããè¿ãããã«ããå¿ è¦ãããã¾ãã </para> <para> <informalexample> <programlisting role="php"> <![CDATA[ <?php header("HTTP/1.0 404 Not Found"); ?> ]]> </programlisting> </informalexample> </para> <note> <para> å®éã« <function>header</function> ãæåã«ã³ã¼ã«ãããã ã©ããã«ããããããHTTP ã¹ãã¼ã¿ã¹ãããè¡ã¯ ã¯ã©ã¤ã¢ã³ãã«å¯¾ãå¸¸ã«æåã«éä¿¡ããã¾ãã HTTP ããããæ¢ã«éä¿¡ããã¦ããªãéãã <function>header</function> ãã³ã¼ã«ãããã¨ã§ã¹ãã¼ã¿ã¹ã¯ 常ã«ä¸æ¸ãããã¾ãã </para> </note> <para> 2 çªç®ã®ç¹å¥ãªãããã¯ã"Location:" ãããã§ãããã®ãããããã©ã¦ã¶ã«è¿ãããã ãã§ã¯ãªãã ãã©ã¦ã¶ã« <literal>REDIRECT</literal> (302) ã¹ãã¼ã¿ã¹ã³ã¼ããè¿ãã¾ã (<literal>3xx</literal> ã¹ãã¼ã¿ã¹ã³ã¼ããæ¢ã«éä¿¡ããã¦ããªãå ´åã«ã®ã¿)ã </para> <para> <informalexample> <programlisting role="php"> <![CDATA[ <?php header("Location: http://www.example.com/"); /* Redirect browser */ /* Make sure that code below does not get executed when we redirect. */ exit; ?> ]]> </programlisting> </informalexample> </para> <note> <para> HTTP/1.1 ã§ã¯ãã¹ãã¼ã ããã¹ãåã絶対ãã¹ãå«ã絶対 <acronym>URI</acronym> ã <ulink url="&spec.http1.1;-sec14.html#sec14.30">Location:</ulink> ã®å¼æ°ã¨ãã¦å¿ è¦ã§ãããç¸å¯¾ URI ãåãä»ããã¯ã©ã¤ã¢ã³ããããã¾ãã é常ã¯ãç¸å¯¾ URI ãã絶対 URI ã使ããããã«ã¯ $_SERVER['HTTP_HOST']ã$_SERVER['PHP_SELF'] ããã³ <function>dirname</function> ã使ç¨ã§ãã¾ãã <informalexample> <programlisting role="php"> <![CDATA[ <?php /* ã«ã¬ã³ããã£ã¬ã¯ããªã®å¥ã®ãã¼ã¸ã«ãªãã¤ã¬ã¯ããã¾ã */ $host = $_SERVER['HTTP_HOST']; $uri = rtrim(dirname($_SERVER['PHP_SELF']), '/\\'); $extra = 'mypage.php'; header("Location: http://$host$uri/$extra"); exit; ?> ]]> </programlisting> </informalexample> </para> </note> <note> <para> <link linkend="ini.session.use-trans-sid">session.use_trans_sid</link> ãæå¹ã§ãã£ãã¨ãã¦ããã»ãã·ã§ã³ ID ã Location ãããã¨ã¨ã㫠渡ããããã¨ã¯ããã¾ããã<constant>SID</constant> 宿°ã使ç¨ã㦠æåã§æ¸¡ãå¿ è¦ãããã¾ãã </para> </note> <para> PHP ã¹ã¯ãªããã¯ãã°ãã°åçã« HTML ãçæãããããã¯ã©ã¤ã¢ã³ã ãã©ã¦ã¶ããµã¼ãããã³ã¯ã©ã¤ã¢ã³ããã©ã¦ã¶ã®éã§ãããã·ããã£ãã·ã¥ã è¡ã£ããããã¹ãã§ã¯ããã¾ãããå¤ãã®ãããã·ã¨ã¯ã©ã¤ã¢ã³ãã§ã¯ã 以ä¸ã®ã³ã¼ãã«ããå¼·å¶çã«ãã£ãã·ã¥ãç¡å¹ã«ã§ãã¾ãã </para> <para> <informalexample> <programlisting role="php"> <![CDATA[ <?php header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1 header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // éå»ã®æ¥ä» ?> ]]> </programlisting> </informalexample> </para> <note> <para> ä¸è¨ã®ããããå ¨ã¦åºåããªãã£ãã¨ãã¦ããã¼ã¸ã®ãã£ãã·ã¥ã è¡ãããªãå ´åããããã¨ã«æ°ä»ãããããã¾ãããããã©ã«ãã® ãã©ã¦ã¶ã®ãã£ãã·ã¥ã®åä½ãã¦ã¼ã¶ã夿´ã§ããææ®µã¯ããã¤ãããã¾ãã ä¸è¨ã®ããããéä¿¡ãããã¨ã«ãããã¹ã¯ãªããã®åºåããã£ãã·ã¥ããã å¯è½æ§ãããè¨å®ã䏿¸ãããã¹ãã§ãã </para> <para> ããã«ã<function>session_cache_limiter</function> ããã³ è¨å® <literal>session.cache_limiter</literal> ãç¨ããã¨ã ã»ãã·ã§ã³ã使ç¨ãããéã«ãã£ãã·ã¥é¢ä¿ã®æ£ãããããã èªåçã«çæããããã¨ãã§ãã¾ãã </para> </note> <para> è¦ãã¦ããã¦é ãããã®ã¯ã<function>header</function> 颿°ã¯ã é常㮠HTML ã¿ã°ã¾ã㯠PHP ããã®åºåã«ãããããããã¹ã¦ã®å®éã® åºåã®åã«ã³ã¼ã«ããå¿ è¦ããããã¨ã§ãã é »åºããã¨ã©ã¼ã¨ãã¦ã<function>include</function> ã¾ã㯠<function>require</function> 颿°ãä»ã®ãã¡ã¤ã«ãã¢ã¯ã»ã¹ãã颿°ã« 空ç½ã¾ãã¯ç©ºè¡ãããã<function>header</function> ã®åã«åºåã è¡ããã¦ãã¾ãã¨ãããã®ãããã¾ããåãåé¡ã¯ãåä¸ã® PHP/HTML ãã¡ã¤ã«ã使ç¨ãã¦ããå ´åã§ãåå¨ãã¾ãã </para> <para> <informalexample> <programlisting role="php"> <![CDATA[ <html> <?php /* ããã¯ã¨ã©ã¼ã¨ãªãã¾ãããã®ä¸ã«åºåããããã¨ã«æ³¨ç®ãã¦ãã ããã * ããã¯header()ã®ã³ã¼ã«ããåã§ããã¨ãããã¨ã«ãªãã¾ã */ header('Location: http://www.example.com/'); ?> ]]> </programlisting> </informalexample> </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'); // downloaded.pdf ã¨ããååã§ä¿åããã¾ã header('Content-Disposition: attachment; filename="downloaded.pdf"'); // ãã¨ã® PDF ã½ã¼ã¹ã¯ original.pdf ã§ã readfile('original.pdf'); ?> ]]> </programlisting> </informalexample> </para> <note> <para> Microsoft Internet Explorer 4.01 ã«ã¯ãã°ãããã ãã®æ¹æ³ãåä½ãã¾ãããããã解決ããæ¹æ³ã¯ããã¾ããã åæ§ã« Microsoft Internet Explorer 5.5 ã«ãããã妨ãããã°ãããã¾ãã ãã¡ãã¯ããµã¼ãã¹ãã㯠2 以éã«ã¢ããã°ã¬ã¼ããããã¨ã§å¯¾å¿ã§ãã¾ãã </para> </note> <note> <simpara> <link linkend="ini.safe-mode">ã»ã¼ãã¢ã¼ã</link>ãæå¹ãªå ´åã¯ã <literal>WWW-Authenticate</literal> ããã (HTTP èªè¨¼ã«ä½¿ç¨ãã) ãè¨å®ããéã«ãã¹ã¯ãªããã® uid ã <literal>realm</literal> é¨ã«è¿½å ããã¾ãã </simpara> </note> <para> <function>headers_sent</function>ã <function>setcookie</function> ããã³ <link linkend="features.http-auth">HTTP èªè¨¼</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-ja/reference/http/reference.xml?r1=1.5&r2=1.6&diff_format=u Index: phpdoc-ja/reference/http/reference.xml diff -u phpdoc-ja/reference/http/reference.xml:1.5 phpdoc-ja/reference/http/reference.xml:1.6 --- phpdoc-ja/reference/http/reference.xml:1.5 Mon Sep 5 11:34:06 2005 +++ phpdoc-ja/reference/http/reference.xml Thu Jul 27 03:32:04 2006 @@ -1,52 +1,183 @@ <?xml version="1.0" encoding="utf-8"?> -<!-- $Revision: 1.5 $ --> -<!-- EN-Revision: 1.8 Maintainer: hirokawa Status: ready --> -<!-- CREDITS: shimooka --> +<!-- $Revision: 1.6 $ --> +<!-- EN-Revision: 1.10 Maintainer: hirokawa Status: ready --> +<!-- CREDITS: shimooka,takagi --> <!-- Purpose: basic.php --> -<!-- Membership: core --> +<!-- Membership: pecl --> - <reference id="ref.http"> - <title>HTTP é¢é£ã®é¢æ°</title> - <titleabbrev>HTTP</titleabbrev> +<reference id="ref.http"> + <title>HTTP</title> + <titleabbrev>http</titleabbrev> - <partintro> - <section id="http.intro"> + <partintro> + <sect1 id="http.intro"> &reftitle.intro; - <para> - 以ä¸ã®é¢æ°ã¯ããªã¢ã¼ããã©ã¦ã¶ã«éãè¿ãããåºåããHTTPãããã³ã« - ã¬ãã«ã§å¶å¾¡ããããã®ãã®ã§ãã - </para> - </section> - - <section id="http.requirements"> - &reftitle.required; - &no.requirement; - </section> - - <section id="http.installation"> - &reftitle.install; - &no.install; - </section> - - <section id="http.configuration"> - &reftitle.runtime; - &no.config; - </section> - - <section id="http.resources"> - &reftitle.resources; - &no.resource; - </section> - - <section id="http.constants"> - &reftitle.constants; - &no.constants; - </section> - </partintro> + <simpara> + ãã® HTTP æ¡å¼µã¢ã¸ã¥ã¼ã«ã®çãã¯ãPHP + ã¢ããªã±ã¼ã·ã§ã³ã®ããã«ä¾¿å©ã§å¼·åãªæ©è½ãæä¾ãããã¨ã§ãã + </simpara> + <simpara> + HTTP ã® URLãæ¥ä»ããªãã¤ã¬ã¯ãããããããã³ã¡ãã»ã¼ã¸ã + 使ããããããã¯ã©ã¤ã¢ã³ãã®å¸æããè¨èªããã³æåã»ããã® + ãã´ã·ã¨ã¼ã·ã§ã³ææ®µãæä¾ãã¾ãã + ã¾ããä»»æã®ãã¼ã¿ãéä¿¡ããéã«ãã£ãã·ã¥ããªã¸ã¥ã¼ã ã®æ©è½ã + ãããããã¨ãã§ãã¾ãã + </simpara> + <simpara> + CURL ãµãã¼ãè¾¼ã¿ã§ãã«ãããã¦ããå ´åã¯ã + å¼·åãªãªã¯ã¨ã¹ãæ©è½ãæä¾ãã¾ããPHP 5 以éã§ã¯ã + è¤æ°ã®ãªã¯ã¨ã¹ããå¹³è¡ãã¦å®è¡ãããã¨ãã§ãã¾ãã + </simpara> + <simpara> + ãã®ããã¥ã¢ã«ã§ã¯ãAPI ãªãã¡ã¬ã³ã¹ã«å ã㦠+ ã¤ã³ã¹ãã¼ã«ãè¨å®ã®æ¹æ³ãå®ç¾©æ¸ã¿ã®ã°ãã¼ãã«å®æ°ãªã©ã + 以ä¸ã®ç¯ã§èª¬æãã¦ãã¾ãã + </simpara> + <simplelist> + <member><link linkend="http.install">ã¤ã³ã¹ãã¼ã«</link></member> + <member><link linkend="http.configuration">è¨å®</link></member> + <member><link linkend="http.constants">ã°ãã¼ãã«å®æ°</link></member> + </simplelist> + </sect1> + + <sect1> + <title>ã¯ã©ã¹</title> + <simplelist> + <member><link linkend="http.HttpMessage"><classname>HttpMessage</classname></link></member> + <member><link linkend="http.HttpQueryString"><classname>HttpQueryString</classname></link></member> + <member><link linkend="http.HttpDeflateStream"><classname>HttpDeflateStream</classname></link></member> + <member><link linkend="http.HttpInflateStream"><classname>HttpInflateStream</classname></link></member> + <member><link linkend="http.HttpRequest"><classname>HttpRequest</classname></link></member> + <member><link linkend="http.HttpRequestPool"><classname>HttpRequestPool</classname></link></member> + </simplelist> + </sect1> + + <sect1> + <title>颿°</title> + <sect2> + <title>çµã¿è¾¼ã¿ã®é¢æ°</title> + <simpara> + ãã®ãã¼ã¸ã§èª¬æãã¦ãã以å¤ã«ãçµã¿è¾¼ã¿ã® HTTP é¢é£é¢æ°ã + <link linkend="ref.network">ãããã¯ã¼ã¯é¢æ°</link> + ã«æãããã¦ãã¾ãã + </simpara> + <simpara> + 以ä¸ã®é¢æ°ã¯ãHTTP ã¢ã¸ã¥ã¼ã«ãå¿ è¦ã¨ãã¾ããã + <function>header</function>ã<function>headers_list</function>ã<function>headers_sent</function>ã + <function>setcookie</function> &listendand; <function>setrawcookie</function>ã + </simpara> + </sect2> + <sect2> + <title>ãã£ãã·ã¥</title> + <simplelist> + <member><link linkend="function.http-cache-etag"><function>http_cache_etag</function></link></member> + <member><link linkend="function.http-cache-last-modified"><function>http_cache_last_modified</function></link></member> + </simplelist> + </sect2> + <sect2> + <title>ã¨ã³ã³ã¼ãã£ã³ã°</title> + <simplelist> + <member><link linkend="function.http-chunked-decode"><function>http_chunked_decode</function></link></member> + <member><link linkend="function.http-deflate"><function>http_deflate</function></link></member> + <member><link linkend="function.http-inflate"><function>http_inflate</function></link></member> + </simplelist> + </sect2> + <sect2> + <title>éå¤ãªé¢æ°</title> + <simplelist> + <member><link linkend="function.http-build-cookie"><function>http_build_cookie</function></link></member> + <member><link linkend="function.http-date"><function>http_date</function></link></member> + <member><link linkend="function.http-get-request-body-stream"><function>http_get_request_body_stream</function></link></member> + <member><link linkend="function.http-get-request-body"><function>http_get_request_body</function></link></member> + <member><link linkend="function.http-get-request-headers"><function>http_get_request_headers</function></link></member> + <member><link linkend="function.http-match-etag"><function>http_match_etag</function></link></member> + <member><link linkend="function.http-match-modified"><function>http_match_modified</function></link></member> + <member><link linkend="function.http-match-request-header"><function>http_match_request_header</function></link></member> + <member><link linkend="function.http-support"><function>http_support</function></link></member> + </simplelist> + </sect2> + <sect2> + <title>ãã´ã·ã¨ã¼ã·ã§ã³</title> + <simplelist> + <member><link linkend="function.http-negotiate-charset"><function>http_negotiate_charset</function></link></member> + <member><link linkend="function.http-negotiate-ctype"><function>http_negotiate_ctype</function></link></member> + <member><link linkend="function.http-negotiate-language"><function>http_negotiate_language</function></link></member> + </simplelist> + </sect2> + <sect2> + <title>åºåãã³ãã©</title> + <simplelist> + <member><link linkend="function.ob-deflatehandler"><function>ob_deflatehandler</function></link></member> + <member><link linkend="function.ob-etaghandler"><function>ob_etaghandler</function></link></member> + <member><link linkend="function.ob-inflatehandler"><function>ob_inflatehandler</function></link></member> + </simplelist> + </sect2> + <sect2> + <title>ãã¼ãµ</title> + <simplelist> + <member><link linkend="function.http-parse-cookie"><function>http_parse_cookie</function></link></member> + <member><link linkend="function.http-parse-headers"><function>http_parse_headers</function></link></member> + <member><link linkend="function.http-parse-message"><function>http_parse_message</function></link></member> + <member><link linkend="function.http-parse-params"><function>http_parse_params</function></link></member> + </simplelist> + </sect2> + <sect2> + <title>ãªã¯ã¨ã¹ã</title> + <simplelist> + <member><link linkend="function.http-get"><function>http_get</function></link></member> + <member><link linkend="function.http-head"><function>http_head</function></link></member> + <member><link linkend="function.http-post-data"><function>http_post_data</function></link></member> + <member><link linkend="function.http-post-fields"><function>http_post_fields</function></link></member> + <member><link linkend="function.http-put-data"><function>http_put_data</function></link></member> + <member><link linkend="function.http-put-file"><function>http_put_file</function></link></member> + <member><link linkend="function.http-put-stream"><function>http_put_stream</function></link></member> + <member><link linkend="function.http-request-body-encode"><function>http_request_body_encode</function></link></member> + <member><link linkend="function.http-request-method-exists"><function>http_request_method_exists</function></link></member> + <member><link linkend="function.http-request-method-name"><function>http_request_method_name</function></link></member> + <member><link linkend="function.http-request-method-register"><function>http_request_method_register</function></link></member> + <member><link linkend="function.http-request-method-unregister"><function>http_request_method_unregister</function></link></member> + <member><link linkend="function.http-request"><function>http_request</function></link></member> + </simplelist> + </sect2> + <sect2> + <title>ã¬ã¹ãã³ã¹</title> + <simplelist> + <member><link linkend="function.http-redirect"><function>http_redirect</function></link></member> + <member><link linkend="function.http-send-content-disposition"><function>http_send_content_disposition</function></link></member> + <member><link linkend="function.http-send-content-type"><function>http_send_content_type</function></link></member> + <member><link linkend="function.http-send-data"><function>http_send_data</function></link></member> + <member><link linkend="function.http-send-file"><function>http_send_file</function></link></member> + <member><link linkend="function.http-send-last-modified"><function>http_send_last_modified</function></link></member> + <member><link linkend="function.http-send-status"><function>http_send_status</function></link></member> + <member><link linkend="function.http-send-stream"><function>http_send_stream</function></link></member> + <member><link linkend="function.http-throttle"><function>http_throttle</function></link></member> + </simplelist> + </sect2> + <sect2> + <title>URL</title> + <simplelist> + <member><link linkend="function.http-build-str"><function>http_build_str</function></link></member> + <member><link linkend="function.http-build-url"><function>http_build_url</function></link></member> + </simplelist> + </sect2> + </sect1> + + </partintro> + + &reference.http.install; + &reference.http.configuration; + &reference.http.constants; + &reference.http.HttpMessage; + &reference.http.HttpQueryString; + &reference.http.HttpDeflateStream; + &reference.http.HttpInflateStream; + &reference.http.HttpRequest; + &reference.http.HttpRequestPool; + &reference.http.HttpResponse; + &reference.http.functions; -&reference.http.functions; +</reference> - </reference> <!-- Keep this comment at the end of the file Local variables: mode: sgml @@ -67,4 +198,3 @@ vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> - http://cvs.php.net/viewvc.cgi/phpdoc-ja/reference/network/functions/setrawcookie.xml?view=markup&rev=1.1 Index: phpdoc-ja/reference/network/functions/setrawcookie.xml +++ phpdoc-ja/reference/network/functions/setrawcookie.xml <?xml version="1.0" encoding="utf-8"?> <!-- $Revision: 1.1 $ --> <!-- EN-Revision: 1.1 Maintainer: takagi Status: ready --> <refentry id="function.setrawcookie"> <refnamediv> <refname>setrawcookie</refname> <refpurpose>å¤ã URL ã¨ã³ã³ã¼ãããã«ã¯ããã¼ãéä¿¡ãã</refpurpose> </refnamediv> <refsect1> <title>説æ</title> <methodsynopsis> <type>bool</type><methodname>setrawcookie</methodname> <methodparam><type>string</type><parameter>name</parameter></methodparam> <methodparam choice="opt"><type>string</type><parameter>value</parameter></methodparam> <methodparam choice="opt"><type>int</type><parameter>expire</parameter></methodparam> <methodparam choice="opt"><type>string</type><parameter>path</parameter></methodparam> <methodparam choice="opt"><type>string</type><parameter>domain</parameter></methodparam> <methodparam choice="opt"><type>bool</type><parameter>secure</parameter></methodparam> </methodsynopsis> <para> <function>setrawcookie</function> ã¯ã ãã©ã¦ã¶ã«éä¿¡ãããéã¯ããã¼ã®å¤ãèªåçã« URL ã¨ã³ã³ã¼ããããªããã¨ãé¤ãã <function>setcookie</function> ã¨ç価ã§ãã </para> <para> <function>header</function>ã<function>setcookie</function> ããã³ <link linkend="features.cookies">ã¯ããã¼ã®ã»ã¯ã·ã§ã³</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-ja/reference/network/functions/setcookie.xml?view=markup&rev=1.1 Index: phpdoc-ja/reference/network/functions/setcookie.xml +++ phpdoc-ja/reference/network/functions/setcookie.xml <?xml version="1.0" encoding="utf-8"?> <!-- $Revision: 1.1 $ --> <!-- EN-Revision: 1.1 Maintainer: takagi Status: ready --> <refentry id="function.setcookie"> <refnamediv> <refname>setcookie</refname> <refpurpose>ã¯ããã¼ãéä¿¡ãã</refpurpose> </refnamediv> <refsect1> <title>説æ</title> <methodsynopsis> <type>bool</type><methodname>setcookie</methodname> <methodparam><type>string</type><parameter>name</parameter></methodparam> <methodparam choice="opt"><type>string</type><parameter>value</parameter></methodparam> <methodparam choice="opt"><type>int</type><parameter>expire</parameter></methodparam> <methodparam choice="opt"><type>string</type><parameter>path</parameter></methodparam> <methodparam choice="opt"><type>string</type><parameter>domain</parameter></methodparam> <methodparam choice="opt"><type>bool</type><parameter>secure</parameter></methodparam> </methodsynopsis> <para> <function>setcookie</function> ã¯ããã®ä»ã®ãããæ å ±ã¨å ±ã« éä¿¡ããã¯ããã¼ãå®ç¾©ãã¾ãã ã»ãã®ãããæ å ±ã¨åæ§ã«ã ã¯ããã¼ã¯ãã¹ã¯ãªããã«ããä»ã®ããããåºåããã<emphasis>åã«</emphasis> éä¿¡ãããå¿ è¦ãããã¾ãï¼ããã¯HTTPãããã³ã«ã®å¶ç´ã§ãï¼ã <literal><html></literal> ã <literal><head></literal> ã¿ã°ã¯ãã¡ãã 空ç½ãå«ããããããåºåãããåã«ãã®é¢æ°ãã³ã¼ã«ããããã«ããªããã°ãªãã¾ããã ããããã®é¢æ°ãã³ã¼ã«ããåã«ä½ããã®åºåãããå ´åã«ã¯ã <function>setcookie</function> ã¯å¤±æã &false; ãè¿ãã¾ãã <function>setcookie</function> ãæ£å¸¸ã«å®è¡ãããã¨ã&true; ãè¿ãã¾ãã ãã®é¢æ°ã¯ã¦ã¼ã¶ã¼ãã¯ããã¼ãåãå ¥ãããã©ããã示ããã¨ã¯ãã¾ããã </para> <note> <para> PHP 4 ã§ã¯ããã®é¢æ°ãã³ã¼ã«ããåã§ãåºåã§ããããã«ã ã¹ã¯ãªããã®å ¨ã¦ã®åºåããµã¼ãå ã«ãããã¡ãªã³ã°ããããã¨ãã§ãã¾ãã ãã®ããã«ã¯ã<function>ob_start</function> ã <function>ob_end_flush</function> ã使ç¨ããããããã㯠&php.ini; ã® <literal>output_buffering</literal> è¨å®ã使ç¨ãã¾ãã </para> </note> <para> <parameter>name</parameter> 以å¤ã®å ¨ã¦ã®å¼æ°ã¯ãªãã·ã§ã³ã§ãã å ¨ã¦ã®å¼æ°ã«é¢ãã¦å¼æ°ã®æå®ãã¹ãããããããã«ç©ºæåå (<emphasis>""</emphasis>) ã¨ãããã¨ãå¯è½ã§ãã <parameter>expire</parameter> ããã³ <parameter>secure</parameter> ã¯æ°å¤ãªã®ã§ã空æååã§ã¹ããããããã¨ã¯ã§ãã¾ããã代ããã«ã¼ã (<emphasis>0</emphasis>) ã使ç¨ãã¦ãã ããã 以ä¸ã®è¡¨ã¯ <function>setcookie</function> ã®å¼æ°ã®èª¬æã§ãã <function>setcookie</function> 颿°ã®å弿°ã ã©ã®ããã«ä½ç¨ããããç¥ãã«ã¯ <ulink url="&spec.cookies;">Netscape cookie specification</ulink> ãããã㦠HTTP ã¯ããã¼ã®åä½ã«ã¤ãã¦ã®è©³ç´°ãªæ å ±ã¯ ã¨<ulink url="&url.rfc;2965">RFC 2965</ulink> ãåç §ãã ããã </para> <para> <table> <title><function>setcookie</function> 弿°ã®èª¬æ</title> <tgroup cols="3"> <thead> <row> <entry>弿°</entry> <entry>説æ</entry> <entry>ä¾</entry> </row> </thead> <tbody> <row> <entry><parameter>name</parameter></entry> <entry> ã¯ããã¼ã®åå </entry> <entry> 'cookiename' ã <varname>$_COOKIE['cookiename'] ã¨ãã¦ã³ã¼ã«ããã¾ãã</varname> </entry> </row> <row> <entry><parameter>value</parameter></entry> <entry> ã¯ããã¼ã®å¤ããã®å¤ã¯ã¯ã©ã¤ã¢ã³ãã®ã³ã³ãã¥ã¼ã¿ã«ä¿åããã¾ãã®ã§ã éè¦ãªæ å ±ã¯æ ¼ç´ããªãã§ãã ããã </entry> <entry> <parameter>name</parameter> ã 'cookiename' ã ã¨ããã¨ã ãã®å¤ã¯ <varname>$_COOKIE['cookiename']</varname> ã§åå¾ãããã¨ãã§ãã¾ãã </entry> </row> <row> <entry><parameter>expire</parameter></entry> <entry> ã¯ããã¼ã®æå¹æéããã㯠Unix ã¿ã¤ã ã¹ã¿ã³ããªã®ã§ Epochï¼1970 å¹´ 1 æ 1 æ¥ï¼ããã®çµéç§æ°ã¨ãªãã¾ãã <function>time</function> ã¾ã㯠<function>mktime</function> 颿°ã«ãã è¿ãããç¾å¨ã®UNIXæ¨æºæã«ãæéã¨ãããå¿ è¦ãªç§æ°ãå ç®ãããã®ã å©ç¨ãããã¨ãã§ããã§ãããã </entry> <entry> <literal>time()+60*60*24*30</literal> ã¯ã¯ããã¼ã®æå¹æéã 30 æ¥å¾ã«ã»ãããã¾ãã ãããè¨å®ããªãå ´åãã¯ããã¼ã¯ã»ãã·ã§ã³ã®æå¾ (ã¤ã¾ããã©ã¦ã¶ãéããã¨ã) ãæå¹æéã¨ãªãã¾ãã </entry> </row> <row> <entry><parameter>path</parameter></entry> <entry> ãµã¼ãã¼ä¸ã§ã®ãã¯ããã¼ãæå¹ã¨ããããã¹ </entry> <entry> <literal>'/'</literal> ãã»ããããã¨ãã¯ããã¼ã¯ <parameter>domain</parameter> é ä¸ã®å ¨ã¦ã§æå¹ã¨ãªãã¾ãã <literal>'/foo/'</literal> ãã»ããããã¨ãã¯ããã¼ã¯ <literal>/foo/</literal> ãã£ã¬ã¯ããªã¨ãã®ãµããã£ã¬ã¯ããªé ä¸ (ä¾ãã° <literal>/foo/bar/</literal>) ã§æå¹ã¨ãªãã¾ãã ããã©ã«ãå¤ã¯ãã¯ããã¼ãã»ãããããã¨ãã®ã«ã¬ã³ããã£ã¬ã¯ããªã§ãã </entry> </row> <row> <entry><parameter>domain</parameter></entry> <entry> ã¯ããã¼ãæå¹ãªãã¡ã¤ã³ </entry> <entry> exapmle.com ã®å ¨ã¦ã®ãµããã¡ã¤ã³ã§ã¯ããã¼ãæå¹ã¨ããã«ã¯ <literal>'.example.com'</literal> ãã»ãããã¾ãã <literal>.</literal> ã¯å¿ é ã§ã¯ããã¾ãããã å¤ãã®ãã©ã¦ã¶ã«ããã¦äºææ§ãããã¾ãã <literal>www.example.com</literal> ã«ã»ããããã¨ã ã¯ããã¼ã¯<literal>www</literal> ãµããã¡ã¤ã³ã«ããã¦ã®ã¿æå¹ã¨ãªãã¾ãã æ«å°¾ã®ãããã³ã°ã«ã¤ãã¦ã®è©³ç´°ã¯ <ulink url="&spec.cookies;">仿§</ulink> ãã覧ãã ããã </entry> </row> <row> <entry><parameter>secure</parameter></entry> <entry> ã»ãã¥ã¢ãª HTTPS æ¥ç¶ã®å ´åã«ã®ã¿ã¯ããã¼ãéä¿¡ãããããã«ãã¾ãã &true; ãè¨å®ããã¨ãã»ãã¥ã¢ãªæ¥ç¶ãåå¨ããå ´åã«ã®ã¿ã¯ããã¼ã è¨å®ãã¾ããããã©ã«ã㯠&false; ã§ãã </entry> <entry> <literal>0</literal> ã¾ã㯠<literal>1</literal> </entry> </row> </tbody> </tgroup> </table> </para> <para> ä¸åº¦ã¯ããã¼ãéä¿¡ãããã¨ã次ã®ãã¼ã¸ã®ãã¼ããã㯠<link linkend="reserved.variables.cookies">$_COOKIE</link> ã <varname>$HTTP_COOKIE_VARS</varname> é åã«ãã£ã¦ã¯ããã¼ã«ã¢ã¯ã»ã¹ã§ãã¾ãã <varname>$_COOKIE</varname> ã®ãã㪠<link linkend="language.variables.superglobals">autoglobals</link> 㯠<ulink url="&url.php.release4.1.0;">4.1.0</ulink> 以éã§æå¹ã¨ãªããã¨ã«æ³¨æãã¦ãã ããã <varname>$HTTP_COOKIE_VARS</varname> 㯠PHP 3 以éã§ä½¿ç¨ã§ãã¾ãã ã¯ããã¼ã®å¤ã¯ <link linkend="reserved.variables.request">$_REQUEST</link> é åãããã¢ã¯ã»ã¹ã§ãã¾ãã </para> <note> <para> PHPã® <link linkend="ini.register-globals">register_globals</link> ãã£ã¬ã¯ãã£ãã <literal>on</literal> ã«ãªã£ã¦ããå ´åã ã¯ããã¼ã¯å¤æ°ã«ãç»é²ããã¦ãã¾ãã 以ä¸ã®ä¾ã§ã¯ã<varname>$TestCookie</varname> 夿°ãåå¨ãã¾ãã <varname>$_COOKIE</varname> ã®ä½¿ç¨ãæ¨å¥¨ããã¾ãã </para> </note> <para> é¥ãããã失æ <itemizedlist> <listitem> <simpara> ã¯ããã¼ã¯ãã¯ããã¼ãæå¹ã«ããããã«æ¬¡ã«ãã¼ã¸ããã¼ãããã¾ã§ ã¢ã¯ã»ã¹ãããã¨ãã§ãã¾ãããã¯ããã¼ãæ£å¸¸ã«ã»ãããããã ãã¹ãããããã«ãã¯ããã¼ã®æå¹æéãåããåã«æ¬¡ã®ãã¼ã¸ã ãã¼ããã¦ã¯ããã¼ããã§ãã¯ãã¦ãã ããã æå¹æé㯠<parameter>expire</parameter> 弿°ã§ã»ããããã¾ãã ã¯ããã¼ã®å©ç¨ã«ã¤ãã¦ãããã°ããã®ã«è¯ãæ¹æ³ã¯ <literal>print_r($_COOKIE);</literal> ãã³ã¼ã«ãããã¨ã§ãã </simpara> </listitem> <listitem> <simpara> ã¯ããã¼ã¯è¨å®ããããã®ã¨åããã©ã¡ã¼ã¿ã§åé¤ããå¿ è¦ãããã¾ãã å¤ã空æåå ("") ã§ããã®ä»ã®å ¨ã¦ã®å¼æ°ãåã« setcookie ãã³ã¼ã«ããæã¨åãã§ããå ´åã«ãæå®ãããååã®ã¯ããã¼ã ãªã¢ã¼ãã¯ã©ã¤ã¢ã³ãä¸ããåé¤ããã¾ãã </simpara> </listitem> <listitem> <simpara> ã¯ããã¼ã®å¤ã¨ã㦠&false; ãè¨å®ããã¨ãã¯ããã¼ãåé¤ãããã¨ãã¾ãã ãã®ãããboolean å¤ã¯ä½¿ç¨ã§ãã¾ããããã®ä»£ããã¨ãã¦ã &false; ã§ã¯ãªã <emphasis>0</emphasis>ããã㦠&true; ã§ã¯ãªã <emphasis>1</emphasis> ã使ç¨ãã¾ãã </simpara> </listitem> <listitem> <simpara> ã¯ããã¼åã§é åãè¨è¿°ãããã¨ã«ããã ã¯ããã¼ã®é åãè¨å®ãããã¨ãå¯è½ã§ãããè¤æ°ã®ã¯ããã¼ ãã¦ã¼ã¶ã¼ã®ã·ã¹ãã ä¸ã«ä¿åããããã¨ã«ãªãã¾ãã <function>explode</function> ã使ç¨ã㦠ã²ã¨ã¤ã®ã¯ããã¼ä¸ã«è¤æ°ã®ååã¨å¤ãã»ãããããã¨ã èæ ®ãã¦ãã ããã<function>serialize</function> ã®ä½¿ç¨ã¯ã»ãã¥ãªãã£ã¼ãã¼ã«ã«ãªãå¾ãããã ãã®ç®çã®ããã«ä½¿ç¨ãããã¨ã¯æ¨å¥¨ããã¾ããã </simpara> </listitem> </itemizedlist> </para> <simpara> PHP 3 ã«ããã¦åãã¹ã¯ãªããã§ <function>setcookie</function> ãè¤æ°åã³ã¼ã«ããå ´åãéã®é çªã§å®è¡ããã¾ãã ä»ã®ã¯ããã¼ãæ¿å ¥ããåã«ããã¯ããã¼ãåé¤ãããã¨ããå ´åã åé¤ããåã«æ¿å ¥ãè¡ãå¿ è¦ãããã¾ããPHP 4 ã§ã¯ã <function>setcookie</function> ãè¤æ°åã³ã¼ã«ããå ´åã§ãã³ã¼ã«ããé çªã§å®è¡ããã¾ãã </simpara> <para> 以ä¸ã¯ã¯ããã¼ãéä¿¡ããä¾ã§ãã <example> <title><function>setcookie</function> ã«ããéä¿¡ã®ãµã³ãã«</title> <programlisting role="php"> <![CDATA[ <?php $value = 'something from somewhere'; setcookie("TestCookie", $value); setcookie("TestCookie", $value, time()+3600); /* æå¹æéã¯ä¸æéã§ã */ setcookie("TestCookie", $value, time()+3600, "/~rasmus/", ".example.com", 1); ?> ]]> </programlisting> </example> </para> <para> ã¯ããã¼ã® value ã®é¨åã¯ãã¯ããã¼ã®éä¿¡ãè¡ãéã«èªåçã« URL ã¨ã³ã³ã¼ããããã¾ãã¯ããã¼ãåä¿¡ããéã¯ãèªåçã«ãã³ã¼ã ããã¦ã¯ããã¼åã¨åãååã®å¤æ°ã«æ ¼ç´ããããã¨ã«æ³¨æãã¦ãã ããã ãã®æåãæ°ã«å ¥ããªãå ´åããã PHP 5 ã使ç¨ãã¦ãããªã 代ããã« <function>setrawcookie</function> ã使ã£ã¦ãã ããã ã¹ã¯ãªããå é¨ã§ TestCookie ã®å 容ãè¦ããå ´åã¯ã 以ä¸ã®ããããã®ä¾ã使ç¨ãã¾ãã </para> <para> <informalexample> <programlisting role="php"> <![CDATA[ <?php // åã ã®ã¯ããã¼ã表示ãã¾ã echo $_COOKIE["TestCookie"]; echo $HTTP_COOKIE_VARS["TestCookie"]; // ãããã°ï¼ãã¹ãç¨ã«ã¯ãå ¨ã¦ã®ã¯ããã¼ãè¦ãæ¹æ³ãããã¾ãã print_r($_COOKIE); ?> ]]> </programlisting> </informalexample> </para> <para> ã¯ããã¼ãåé¤ããå ´åã«ã¯ããã©ã¦ã¶ã®å餿©æ§ãèµ·åããããã« å¿ ãæå¹æéãéå»ã«è¨å®ããå¿ è¦ãããã¾ãã æ¬¡ã«ãå ã»ã©ä¾ã§éä¿¡ããã¯ããã¼ãåé¤ããä¾ã示ãã¾ãã </para> <para> <example> <title><function>setcookie</function> ã«ããåé¤ã®ä¾</title> <programlisting role="php"> <![CDATA[ <?php // æå¹æéã䏿éåã«è¨å®ãã¾ã setcookie ("TestCookie", "", time() - 3600); setcookie ("TestCookie", "", time() - 3600, "/~rasmus/", ".example.com", 1); ?> ]]> </programlisting> </example> </para> <para> ã¯ããã¼åã§é åãè¨è¿°ãããã¨ã«ãããã¯ããã¼ã®é åãè¨å®ãããã¨ãå¯è½ã§ãã ããã«ããé åè¦ç´ ã¨åæ°ã®ã¯ããã¼ãè¨å®ããã¾ããã ã¯ããã¼ãã¹ã¯ãªããã«åä¿¡ãããéã«ã å¤ã¯ã¯ããã¼åãæããé åã«ç½®ãããããã¾ãã </para> <para> <example> <title><function>setcookie</function> ã¨é å</title> <programlisting role="php"> <![CDATA[ <?php // ã¯ããã¼ãè¨å®ãã¾ã setcookie("cookie[three]", "cookiethree"); setcookie("cookie[two]", "cookietwo"); setcookie("cookie[one]", "cookieone"); // ãã¼ã¸ãåèªã¿è¾¼ã¿ããå¾ã«ã表示ãã¾ã if (isset($_COOKIE['cookie'])) { foreach ($_COOKIE['cookie'] as $name => $value) { echo "$name : $value <br />\n"; } } ?> ]]> </programlisting> <para> ãã®çµæã¯ã次ã®ããã«ãªãã¾ãã </para> <screen> <![CDATA[ three : cookiethree two : cookietwo one : cookieone ]]> </screen> </example> </para> <note> <para> <ulink url="&url.rfc;2109">RFC 2109</ulink> ããã³ <ulink url="&url.rfc;2965">RFC 2695</ulink> ãåèã«ãªãã§ãããã </para> <para> <parameter>expire</parameter> ãã©ã¡ã¼ã¿ã«ã¯ã<literal>Wdy, DD-Mon-YYYY HH:MM:SS GMT</literal> ã¨ãã£ãå½¢å¼ã§ã¯ãªã Unix ã¿ã¤ã ã¹ã¿ã³ããæ¸¡ãã¦ãããã¨ã«ãæ°ã¥ãã§ããããã ããã¯ãPHP ã®å é¨ã§èªåçã«å¤æãè¡ã£ã¦ããããã§ãã </para> <para> <parameter>expire</parameter> ã¯ãã¯ã©ã¤ã¢ã³ãã®æå»ã¨æ¯è¼ããã¾ãã ãµã¼ãã®æå»ã¨ã®æ¯è¼ã§ã¯ããã¾ããã </para> </note> <note> <simpara> ãµã¼ãã¹ãã㯠1 ãé©ç¨ãã Microsoft Internet Explorer 4 ã¯ã ãã¹ã«é¢ãããã©ã¡ã¼ã¿ãè¨å®ããã¯ããã¼ãæ£ç¢ºã«å¦çãããã¨ãã§ãã¾ããã </simpara> <simpara> Netscape Communicator 4.05 ããã³ Microsoft Internet Explorer 3.x ã¯ãpath 㨠time ãè¨å®ããã¦ããªãå ´åã ã¯ããã¼ãæ£ç¢ºã«å¦çãããã¨ãã§ããªãããã§ãã </simpara> </note> <para> <function>header</function>ã<function>setrawcookie</function> ããã³<link linkend="features.cookies">ã¯ããã¼ã®ã»ã¯ã·ã§ã³</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-ja/reference/network/functions/headers-sent.xml?view=markup&rev=1.1 Index: phpdoc-ja/reference/network/functions/headers-sent.xml +++ phpdoc-ja/reference/network/functions/headers-sent.xml <?xml version="1.0" encoding="utf-8"?> <!-- $Revision: 1.1 $ --> <!-- EN-Revision: 1.1 Maintainer: takagi Status: ready --> <refentry id="function.headers-sent"> <refnamediv> <refname>headers_sent</refname> <refpurpose>ããããæ¢ã«éä¿¡ããã¦ãããã©ããã調ã¹ã</refpurpose> </refnamediv> <refsect1> <title>説æ</title> <methodsynopsis> <type>bool</type><methodname>headers_sent</methodname> <methodparam choice="opt"><type>string</type><parameter role="reference">file</parameter></methodparam> <methodparam choice="opt"><type>int</type><parameter role="reference">line</parameter></methodparam> </methodsynopsis> <simpara> <function>headers_sent</function> ã¯ãHTTP ããããæ¢ã«éä¿¡ããã¦ããå ´åã« &true; ãããã§ãªãå ´åã« &false; ãè¿ãã¾ãã ã¾ãããªãã·ã§ã³å¼æ°ã® <parameter>file</parameter> 㨠<parameter>line</parameter> ãã»ããããã¦ããå ´åã PHP ã®ã½ã¼ã¹ãã¡ã¤ã«åã¨åºåãéå§ãããè¡çªå·ãããããã <parameter>file</parameter> 㨠<parameter>line</parameter> ã«æ ¼ç´ããã¾ãã </simpara> <simpara> ããããããã¯ããã£ããéä¿¡ããã¦ãã¾ã£ãå¾ã§ <function>header</function> 颿°ã使ã£ã¦æ°ããªãããè¡ãéä¿¡ãããã¨ã¯ã§ãã¾ããã ãã®é¢æ°ã使ãã«ã¯ãå°ãªãã¨ã HTTP ãããé¢é£ã®ã¨ã©ã¼ãäºé²ããå¿ è¦ãããã¾ãã ãããã¯ã<link linkend="ref.outcontrol">åºåãããã¡ãªã³ã°</link>ã ä½¿ãæ¹æ³ãããã¾ãã </simpara> <note> <simpara> ãªãã·ã§ã³ã®ãã©ã¡ã¼ã¿ <parameter>file</parameter> 㨠<parameter>line</parameter> ã PHP 4.3.0 ã§è¿½å ããã¾ããã </simpara> </note> <para> <example> <title><function>headers_sent</function> 颿°ã®ä½¿ç¨ä¾</title> <programlisting role="php"> <![CDATA[ <?php // ããããã¾ã ä½ãéä¿¡ããã¦ããªãå ´åã«ãéä¿¡ãã¾ã if (!headers_sent()) { header('Location: http://www.example.com/'); exit; } // ãªãã·ã§ã³ã®fileã¨lineãã©ã¡ã¼ã¿ã®ä½¿ç¨ä¾ï¼PHP4.3.0以éï¼ // $filename 㨠$linenum ãå¾ã§ä½¿ç¨ããã¦ãããã¨ã«æ³¨ç®ã // ãããã®å¤æ°ã«äºåã«å¤ãä¸ããããã¦ã¯ããã¾ããã if (!headers_sent($filename, $linenum)) { header('Location: http://www.example.com/'); exit; // ãããããããã§ã¨ã©ã¼å¦çãè¡ãã§ãããã } else { echo "$filename ã® $linenum è¡ç®ã§ãããããã§ã«éä¿¡ããã¦ãã¾ãã\n" . "ãªãã¤ã¬ã¯ãã§ãã¾ããã代ããã«ãã® <a " . "href=\"http://www.example.com\">ãªã³ã¯</a> ãã¯ãªãã¯ãã¦ãã ããã\n"; exit; } ?> ]]> </programlisting> </example> </para> <para> ããã«é¢é£ãããã詳細ãªè°è«ã¯ <function>ob_start</function>ã <function>trigger_error</function>ã <function>header</function> ãåç §ãã ããã </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-ja/reference/network/functions/headers-list.xml?view=markup&rev=1.1 Index: phpdoc-ja/reference/network/functions/headers-list.xml +++ phpdoc-ja/reference/network/functions/headers-list.xml <?xml version="1.0" encoding="utf-8"?> <!-- $Revision: 1.1 $ --> <!-- EN-Revision: 1.1 Maintainer: takagi Status: ready --> <refentry id="function.headers-list"> <refnamediv> <refname>headers_list</refname> <refpurpose>éä¿¡ãã (ãããã¯éä¿¡ãããäºå®ã®) ã¬ã¹ãã³ã¹ãããã®ä¸è¦§ãè¿ã</refpurpose> </refnamediv> <refsect1> <title>説æ</title> <methodsynopsis> <type>array</type><methodname>headers_list</methodname> <void/> </methodsynopsis> <simpara> <function>headers_list</function> ã¯ãã©ã¦ã¶ãããã¯ã¯ã©ã¤ã¢ã³ãã«éä¿¡ããããããã®æ°å¤é åãè¿ãã¾ãã ãããã®ããããéä¿¡ããããã©ããã夿ããããã«ã¯ <function>headers_sent</function> ã使ç¨ãã¾ãã </simpara> <para> <example> <title><function>headers_list</function> ã®ä½¿ç¨ä¾</title> <programlisting role="php"> <![CDATA[ <?php /* setcookie() ã§ã¬ã¹ãã³ã¹ããããããèªèº«ã«è¿½å ãã¾ã */ setcookie('foo', 'bar'); /* ç¬èªã®ã¬ã¹ãã³ã¹ããããå®ç¾©ãã¾ãã ããã¯ã»ã¨ãã©ã®ã¯ã©ã¤ã¢ã³ãã§ç¡è¦ããã */ header("X-Sample-Test: foo"); /* ã¬ã¹ãã³ã¹ããã¬ã¼ã³ããã¹ãã ã¨å®£è¨ãã¾ã */ header('Content-type: text/plain'); /* éä¿¡ãããã¨ãã¦ãããããã¯? */ var_dump(headers_list()); ?> ]]> </programlisting> <para> ãã®åºåã¯æ¬¡ã®éãã§ãã </para> <screen> <![CDATA[ array(4) { [0]=> string(23) "X-Powered-By: PHP/5.1.3" [1]=> string(19) "Set-Cookie: foo=bar" [2]=> string(18) "X-Sample-Test: foo" [3]=> string(24) "Content-type: text/plain" } ]]> </screen> </example> </para> <simpara> <function>headers_sent</function>ã <function>header</function> ããã³ <function>setcookie</function> ãåç §ãã ããã </simpara> </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-ja/reference/network/functions/header.xml?view=markup&rev=1.1 Index: phpdoc-ja/reference/network/functions/header.xml +++ phpdoc-ja/reference/network/functions/header.xml <?xml version="1.0" encoding="utf-8"?> <!-- $Revision: 1.1 $ --> <!-- EN-Revision: 1.1 Maintainer: takagi Status: ready --> <refentry id="function.header"> <refnamediv> <refname>header</refname> <refpurpose>çã® HTTP ããããéä¿¡ãã</refpurpose> </refnamediv> <refsect1> <title>説æ</title> <methodsynopsis> <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_response_code</parameter></methodparam> </methodsynopsis> <para> <function>header</function> ã¯ãçã® <acronym>HTTP</acronym> ããããéä¿¡ããããã«ä½¿ç¨ããã¾ãã <acronym>HTTP</acronym> ãããã«ã¤ãã¦ã®è©³ç´°ãªæ å ±ã¯ <ulink url="&url.rfc;2616">HTTP/1.1 仿§</ulink> ãåç §ãã ããã </para> <note> <para> PHP 4.4.2 ããã³ PHP 5.1.2 以éããã®é¢æ°ã¯ä¸åº¦ã«è¤æ°ã®ãããã éä¿¡ã§ããªãããã«ãªãã¾ãããããã¯ã ãããã¤ã³ã¸ã§ã¯ã·ã§ã³æ»æã¸ã®å¯¾çã§ãã </para> </note> <para> ãªãã·ã§ã³ã®ãã©ã¡ã¼ã¿ <parameter>replace</parameter> ã¯ããããã åã«éä¿¡ãããé¡ä¼¼ã®ããããç½®æããããã¾ãã¯ãåãå½¢å¼ã®äºçªç®ã® ãããã追å ãããã©ãããæå®ãã¾ããããã©ã«ãã§ã¯ããã®é¢æ°ã¯ ç½®æãè¡ãªãã¾ãããäºçªç®ã®å¼æ°ã« &false; ãæå®ããã¨ãåãåã® è¤æ°ã®ããããå¼·å¶çã«çæãã¾ããä¾ãã°ã </para> <para> <informalexample> <programlisting role="php"> <![CDATA[ <?php header('WWW-Authenticate: Negotiate'); header('WWW-Authenticate: NTLM', false); ?> ]]> </programlisting> </informalexample> </para> <para> 第äºãªãã·ã§ã³å¼æ° <parameter>http_response_code</parameter> 㯠HTTP ã¬ã¹ãã³ã¹ã³ã¼ããå¼·å¶çã«æå®ã®å¤ã«ãã¾ã (ãã®ãã©ã¡ã¼ã¿ã¯ PHP 4.3.0 以éã§æå¹ã§ã)ã </para> <para> ç¹æ®ãª header ã³ã¼ã«ã 2 種é¡ããã¾ããæåã®ãã®ã¯ã æåå "<literal>HTTP/</literal>" ããå§ã¾ãå ¨ã¦ã®ããã (大æåã»å°æåã¯åºå¥ããã¾ãã) ã§ãã ãã®ãããã¯ãéä¿¡ãã HTTP ã¹ãã¼ã¿ã¹ã³ã¼ãã示ãããã«ä½¿ç¨ããã¾ãã ä¾ãã°ãåå¨ããªããã¡ã¤ã«ã¸ã®ãªã¯ã¨ã¹ããå¦çããããã«ãã PHP ã¹ã¯ãªããã使ç¨ãããã (<literal>ErrorDocument</literal> ãã£ã¬ã¯ãã£ãã«ãã) Apache ãè¨å®ããå ´åã ãã®ã¹ã¯ãªãããæ£ããã¹ãã¼ã¿ã¹ã³ã¼ããè¿ãããã«ããå¿ è¦ãããã¾ãã </para> <para> <informalexample> <programlisting role="php"> <![CDATA[ <?php header("HTTP/1.0 404 Not Found"); ?> ]]> </programlisting> </informalexample> </para> <note> <para> å®éã« <function>header</function> ãæåã«ã³ã¼ã«ãããã ã©ããã«ããããããHTTP ã¹ãã¼ã¿ã¹ãããè¡ã¯ ã¯ã©ã¤ã¢ã³ãã«å¯¾ãå¸¸ã«æåã«éä¿¡ããã¾ãã HTTP ããããæ¢ã«éä¿¡ããã¦ããªãéãã <function>header</function> ãã³ã¼ã«ãããã¨ã§ã¹ãã¼ã¿ã¹ã¯ 常ã«ä¸æ¸ãããã¾ãã </para> </note> <para> 2 çªç®ã®ç¹å¥ãªãããã¯ã"Location:" ãããã§ãããã®ãããããã©ã¦ã¶ã«è¿ãããã ãã§ã¯ãªãã ãã©ã¦ã¶ã« <literal>REDIRECT</literal> (302) ã¹ãã¼ã¿ã¹ã³ã¼ããè¿ãã¾ã (<literal>3xx</literal> ã¹ãã¼ã¿ã¹ã³ã¼ããæ¢ã«éä¿¡ããã¦ããªãå ´åã«ã®ã¿)ã </para> <para> <informalexample> <programlisting role="php"> <![CDATA[ <?php header("Location: http://www.example.com/"); /* Redirect browser */ /* Make sure that code below does not get executed when we redirect. */ exit; ?> ]]> </programlisting> </informalexample> </para> <note> <para> HTTP/1.1 ã§ã¯ãã¹ãã¼ã ããã¹ãåã絶対ãã¹ãå«ã絶対 <acronym>URI</acronym> ã <ulink url="&spec.http1.1;-sec14.html#sec14.30">Location:</ulink> ã®å¼æ°ã¨ãã¦å¿ è¦ã§ãããç¸å¯¾ URI ãåãä»ããã¯ã©ã¤ã¢ã³ããããã¾ãã é常ã¯ãç¸å¯¾ URI ãã絶対 URI ã使ããããã«ã¯ $_SERVER['HTTP_HOST']ã$_SERVER['PHP_SELF'] ããã³ <function>dirname</function> ã使ç¨ã§ãã¾ãã <informalexample> <programlisting role="php"> <![CDATA[ <?php /* ã«ã¬ã³ããã£ã¬ã¯ããªã®å¥ã®ãã¼ã¸ã«ãªãã¤ã¬ã¯ããã¾ã */ $host = $_SERVER['HTTP_HOST']; $uri = rtrim(dirname($_SERVER['PHP_SELF']), '/\\'); $extra = 'mypage.php'; header("Location: http://$host$uri/$extra"); exit; ?> ]]> </programlisting> </informalexample> </para> </note> <note> <para> <link linkend="ini.session.use-trans-sid">session.use_trans_sid</link> ãæå¹ã§ãã£ãã¨ãã¦ããã»ãã·ã§ã³ ID ã Location ãããã¨ã¨ã㫠渡ããããã¨ã¯ããã¾ããã<constant>SID</constant> 宿°ã使ç¨ã㦠æåã§æ¸¡ãå¿ è¦ãããã¾ãã </para> </note> <para> PHP ã¹ã¯ãªããã¯ãã°ãã°åçã« HTML ãçæãããããã¯ã©ã¤ã¢ã³ã ãã©ã¦ã¶ããµã¼ãããã³ã¯ã©ã¤ã¢ã³ããã©ã¦ã¶ã®éã§ãããã·ããã£ãã·ã¥ã è¡ã£ããããã¹ãã§ã¯ããã¾ãããå¤ãã®ãããã·ã¨ã¯ã©ã¤ã¢ã³ãã§ã¯ã 以ä¸ã®ã³ã¼ãã«ããå¼·å¶çã«ãã£ãã·ã¥ãç¡å¹ã«ã§ãã¾ãã </para> <para> <informalexample> <programlisting role="php"> <![CDATA[ <?php header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1 header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // éå»ã®æ¥ä» ?> ]]> </programlisting> </informalexample> </para> <note> <para> ä¸è¨ã®ããããå ¨ã¦åºåããªãã£ãã¨ãã¦ããã¼ã¸ã®ãã£ãã·ã¥ã è¡ãããªãå ´åããããã¨ã«æ°ä»ãããããã¾ãããããã©ã«ãã® ãã©ã¦ã¶ã®ãã£ãã·ã¥ã®åä½ãã¦ã¼ã¶ã夿´ã§ããææ®µã¯ããã¤ãããã¾ãã ä¸è¨ã®ããããéä¿¡ãããã¨ã«ãããã¹ã¯ãªããã®åºåããã£ãã·ã¥ããã å¯è½æ§ãããè¨å®ã䏿¸ãããã¹ãã§ãã </para> <para> ããã«ã<function>session_cache_limiter</function> ããã³ è¨å® <literal>session.cache_limiter</literal> ãç¨ããã¨ã ã»ãã·ã§ã³ã使ç¨ãããéã«ãã£ãã·ã¥é¢ä¿ã®æ£ãããããã èªåçã«çæããããã¨ãã§ãã¾ãã </para> </note> <para> è¦ãã¦ããã¦é ãããã®ã¯ã<function>header</function> 颿°ã¯ã é常㮠HTML ã¿ã°ã¾ã㯠PHP ããã®åºåã«ãããããããã¹ã¦ã®å®éã® åºåã®åã«ã³ã¼ã«ããå¿ è¦ããããã¨ã§ãã é »åºããã¨ã©ã¼ã¨ãã¦ã<function>include</function> ã¾ã㯠<function>require</function> 颿°ãä»ã®ãã¡ã¤ã«ãã¢ã¯ã»ã¹ãã颿°ã« 空ç½ã¾ãã¯ç©ºè¡ãããã<function>header</function> ã®åã«åºåã è¡ããã¦ãã¾ãã¨ãããã®ãããã¾ããåãåé¡ã¯ãåä¸ã® PHP/HTML ãã¡ã¤ã«ã使ç¨ãã¦ããå ´åã§ãåå¨ãã¾ãã </para> <para> <informalexample> <programlisting role="php"> <![CDATA[ <html> <?php /* ããã¯ã¨ã©ã¼ã¨ãªãã¾ãããã®ä¸ã«åºåããããã¨ã«æ³¨ç®ãã¦ãã ããã * ããã¯header()ã®ã³ã¼ã«ããåã§ããã¨ãããã¨ã«ãªãã¾ã */ header('Location: http://www.example.com/'); ?> ]]> </programlisting> </informalexample> </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'); // downloaded.pdf ã¨ããååã§ä¿åããã¾ã header('Content-Disposition: attachment; filename="downloaded.pdf"'); // ãã¨ã® PDF ã½ã¼ã¹ã¯ original.pdf ã§ã readfile('original.pdf'); ?> ]]> </programlisting> </informalexample> </para> <note> <para> Microsoft Internet Explorer 4.01 ã«ã¯ãã°ãããã ãã®æ¹æ³ãåä½ãã¾ãããããã解決ããæ¹æ³ã¯ããã¾ããã åæ§ã« Microsoft Internet Explorer 5.5 ã«ãããã妨ãããã°ãããã¾ãã ãã¡ãã¯ããµã¼ãã¹ãã㯠2 以éã«ã¢ããã°ã¬ã¼ããããã¨ã§å¯¾å¿ã§ãã¾ãã </para> </note> <note> <simpara> <link linkend="ini.safe-mode">ã»ã¼ãã¢ã¼ã</link>ãæå¹ãªå ´åã¯ã <literal>WWW-Authenticate</literal> ããã (HTTP èªè¨¼ã«ä½¿ç¨ãã) ãè¨å®ããéã«ãã¹ã¯ãªããã® uid ã <literal>realm</literal> é¨ã«è¿½å ããã¾ãã </simpara> </note> <para> <function>headers_sent</function>ã <function>setcookie</function> ããã³ <link linkend="features.http-auth">HTTP èªè¨¼</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 -->