cvs: phpdoc-ja /reference/url/functions get-headers.xml http-build-query.xml

From: Date: Sat, 20 Aug 2005 14:34:10 +0000
Subject: cvs: phpdoc-ja /reference/url/functions get-headers.xml http-build-query.xml
Groups: php.doc.ja 
Request: Send a blank email to doc-ja+get-1144@lists.php.net to get a copy of this message
shimooka Sat Aug 20 10:34:10 2005 EDT Added files: /phpdoc-ja/reference/url/functions http-build-query.xml get-headers.xml Log: added japanese manual

http://cvs.php.net/co.php/phpdoc-ja/reference/url/functions/http-build-query.xml?r=1.1&p=1 Index: phpdoc-ja/reference/url/functions/http-build-query.xml +++ phpdoc-ja/reference/url/functions/http-build-query.xml <?xml version="1.0" encoding="utf-8"?> <!-- $Revision: 1.1 $ --> <!-- EN-Revision: 1.10 Maintainer: shimooka Status: ready --> <refentry id="function.http-build-query"> <refnamediv> <refname>http_build_query</refname> <refpurpose>URL エンコードされたクエリ文字列を生成する</refpurpose> </refnamediv> <refsect1> <title>説明</title> <methodsynopsis> <type>string</type><methodname>http_build_query</methodname> <methodparam><type>array</type><parameter>formdata</parameter></methodparam> <methodparam choice="opt"><type>string</type><parameter>numeric_prefix</parameter></methodparam> </methodsynopsis> <simpara> 与えられた連想配列 (もしくは添字配列) から URL エンコードされたクエリ文字列を生成します。<parameter>formdata</parameter> にはプロパティを含む配列もしくはオブジェクトを指定可能です。 <parameter>formdata</parameter> 配列には単純は一次元構造、 もしくは配列の配列 (言い換えると、他の配列を含む配列) を指定します。 もし数値インデックスが基底となる配列に使用されたり <parameter>numeric_prefix</parameter> が指定された場合、 基底となる配列の要素に対する数値インデックスの前に追加されます。 この関数はデータが後で PHP や他の CGI アプリケーションによってデコードされる際、 正当な変数名になるよう考慮します。 </simpara> <note> <para> <link linkend="ini.arg-separator.output">arg_separator.output</link> が区分のためのセパレータとして使用されます。 </para> </note> <example> <title><function>http_build_query</function> の簡単な使用法</title> <programlisting role="php"> <![CDATA[ <?php $data = array('foo'=>'bar', 'baz'=>'boom', 'cow'=>'milk', 'php'=>'hypertext processor'); echo http_build_query($data); // foo=bar&baz=boom&cow=milk&php=hypertext+processor ?> ]]> </programlisting> </example> <example> <title>数値インデックス要素の場合での <function>http_build_query</function></title> <programlisting role="php"> <![CDATA[ <?php $data = array('foo', 'bar', 'baz', 'boom', 'cow' => 'milk', 'php' =>'hypertext processor'); echo http_build_query($data); /* 出力: 0=foo&1=bar&2=baz&3=boom&cow=milk&php=hypertext+processor */ echo http_build_query($data, 'myvar_'); /* 出力: myvar_0=foo&myvar_1=bar&myvar_2=baz&myvar_3=boom&cow=milk&php=hypertext+processor */ ?> ]]> </programlisting> </example> <example> <title>複雑な配列の場合での <function>http_build_query</function></title> <programlisting role="php"> <![CDATA[ <?php $data = array('user'=>array('name'=>'Bob Smith', 'age'=>47, 'sex'=>'M', 'dob'=>'5/12/1956'), 'pastimes'=>array('golf', 'opera', 'poker', 'rap'), 'children'=>array('bobby'=>array('age'=>12, 'sex'=>'M'), 'sally'=>array('age'=>8, 'sex'=>'F')), 'CEO'); echo http_build_query($data, 'flags_'); ?> ]]> </programlisting> <para> この例は以下を出力します: (可読性のため適宜折り返しています) </para> <screen> <![CDATA[ user[name]=Bob+Smith&user[age]=47&user[sex]=M&user[dob]=5%1F12%1F1956& pastimes[0]=golf&pastimes[1]=opera&pastimes[2]=poker&pastimes[3]=rap& children[bobby][age]=12&children[bobby][sex]=M&children[sally][age]=8& children[sally][sex]=F&flags_0=CEO ]]> </screen> <para> <note> <para> 基底の配列内の数値インデックス要素 "CEO" のみ、 接頭辞を受け取ります。pastimes 以下にある他の数値インデックスは、 正当な変数名にするための文字列の接頭辞を要求しません。 </para> </note> </para> </example> <example> <title>オブジェクトの場合での <function>http_build_query</function> の使用</title> <programlisting role="php"> <![CDATA[ <?php class myClass { var $foo; var $baz; function myClass() { $this->foo = 'bar'; $this->baz = 'boom'; } } $data = new myClass(); echo http_build_query($data); // foo=bar&baz=boom ?> ]]> </programlisting> </example> <simpara> <function>parse_str</function>, <function>parse_url</function>, <function>urlencode</function>, <function>array_walk</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/co.php/phpdoc-ja/reference/url/functions/get-headers.xml?r=1.1&p=1 Index: phpdoc-ja/reference/url/functions/get-headers.xml +++ phpdoc-ja/reference/url/functions/get-headers.xml <?xml version="1.0" encoding="utf-8"?> <!-- $Revision: 1.1 $ --> <!-- EN-Revision: 1.6 Maintainer: shimooka Status: ready --> <refentry id="function.get-headers"> <refnamediv> <refname>get_headers</refname> <refpurpose> HTTP リクエストに対するレスポンス内で サーバによって送出された全てのヘッダを取得する </refpurpose> </refnamediv> <refsect1> <title>説明</title> <methodsynopsis> <type>array</type><methodname>get_headers</methodname> <methodparam><type>string</type><parameter>url</parameter></methodparam> <methodparam choice="opt"><type>int</type><parameter>format</parameter></methodparam> </methodsynopsis> <para> <function>get_headers</function> は、HTTP リクエストに対するレスポンス内で サーバによって送出されたヘッダの配列を返します。 失敗した場合やエラーレベル <constant>E_WARNING</constant> が発行された場合 &false; を返します。 </para> <para> オプションの <parameter>format</parameter> パラメータが 1 にセットされた場合、<function>get_headers</function> はレスポンスをパースし、配列のキーをセットします。 </para> <para> <example> <title><function>get_headers</function> の例</title> <programlisting role="php"> <![CDATA[ <?php $url = 'http://www.example.com'; print_r(get_headers($url)); print_r(get_headers($url, 1)); ?> ]]> </programlisting> &example.outputs.similar; <screen> <![CDATA[ Array ( [0] => HTTP/1.1 200 OK [1] => Date: Sat, 29 May 2004 12:28:13 GMT [2] => Server: Apache/1.3.27 (Unix) (Red-Hat/Linux) [3] => Last-Modified: Wed, 08 Jan 2003 23:11:55 GMT [4] => ETag: "3f80f-1b6-3e1cb03b" [5] => Accept-Ranges: bytes [6] => Content-Length: 438 [7] => Connection: close [8] => Content-Type: text/html ) Array ( [0] => HTTP/1.1 200 OK [Date] => Sat, 29 May 2004 12:28:14 GMT [Server] => Apache/1.3.27 (Unix) (Red-Hat/Linux) [Last-Modified] => Wed, 08 Jan 2003 23:11:55 GMT [ETag] => "3f80f-1b6-3e1cb03b" [Accept-Ranges] => bytes [Content-Length] => 438 [Connection] => close [Content-Type] => text/html ) ]]> </screen> </example> </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 -->
« previous php.doc.ja (#1144) next »