File: url.xml

package info (click to toggle)
phpdoc 20020310-1
  • links: PTS
  • area: main
  • in suites: woody
  • size: 35,272 kB
  • ctags: 354
  • sloc: xml: 799,767; php: 1,395; cpp: 500; makefile: 200; sh: 140; awk: 51
file content (278 lines) | stat: -rw-r--r-- 10,536 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision: 1.11 $ -->
<reference id="ref.url">
  <title>URL 関数</title>
  <titleabbrev>URLs</titleabbrev>

  <refentry id="function.base64-decode">
   <refnamediv>
    <refname>base64_decode</refname>
    <refpurpose>base64方式によりエンコードされたデータのデコード</refpurpose>
   </refnamediv>
   <refsect1>
    <title>説明</title>
     <methodsynopsis>
      <type>string</type><methodname>base64_decode</methodname>
      <methodparam><type>string</type><parameter>encoded_data</parameter></methodparam>
     </methodsynopsis>
    <para>
     <function>base64_decode</function>は
     <parameter>encoded_data</parameter>をデコードし、
     もとのデータを返します。バイナリになることもあります。
    </para>
    <para>
     <function>base64_encode</function>およびRFC-2045 6.8節も
     参考にしてください。
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.base64-encode">
   <refnamediv>
    <refname>base64_encode</refname>
    <refpurpose>base64方式によるデータのエンコード</refpurpose>
   </refnamediv>
   <refsect1>
    <title>説明</title>
     <methodsynopsis>
      <type>string</type><methodname>base64_encode</methodname>
      <methodparam><type>string</type><parameter>data</parameter></methodparam>
     </methodsynopsis>
    <para>
     <function>base64_encode</function>は、
     <parameter>data</parameter>をbase64方式でエンコードします。
     このエンコードは、メールの本体の様に、8ビットクリーンでは
     ないトランスポート層を通じて、バイナリーデータが生き残れる
     様に設計されています。
    </para>
    <para>
     Base64でエンコードされたデータは、エンコード前のデータにくらべて
     33%余計に容量が必要です。
    </para>
    <para>
    <function>base64_decode</function>,
      <function>chunk_split</function>,
     RFC-2045 6.8節も参照下さい。
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.parse-url">
   <refnamediv>
    <refname>parse_url</refname>
    <refpurpose>URL を解釈し、その構成要素を返します</refpurpose>
   </refnamediv>
   <refsect1>
    <title>説明</title>
     <methodsynopsis>
      <type>array</type><methodname>parse_url</methodname>
      <methodparam><type>string</type><parameter>url</parameter></methodparam>
     </methodsynopsis>
    <para>
     この関数は、URL の様々な構成要素のうち特定できるものに関して
     連想配列にして返します。 この要素には、
     "scheme", "host", "port", "user", "pass", "path", "query", 
     "fragment" があります。
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.rawurldecode">
   <refnamediv>
    <refname>rawurldecode</refname>
    <refpurpose>URL エンコードされた文字列をデコードする</refpurpose>
   </refnamediv>
   <refsect1>
    <title>説明</title>
     <methodsynopsis>
      <type>string</type><methodname>rawurldecode</methodname>
      <methodparam><type>string</type><parameter>str</parameter></methodparam>
     </methodsynopsis>
    <para>
     文字列の中にパーセント記号(<literal>%</literal>)に続いて
     2 つの 16 進数があるような表現形式を、文字定数に置き換えて
     返します。たとえば、<screen>foo%20bar%40baz</screen> という
     文字列は <screen>foo bar@baz</screen> としてデコードされます。
    </para>
    <simpara>
     <function>rawurlencode</function>, 
     <function>urldecode</function>,
     <function>urlencode</function> も参照下さい。
    </simpara>
   </refsect1>
  </refentry>

  <refentry id="function.rawurlencode">
   <refnamediv>
    <refname>rawurlencode</refname>
    <refpurpose>RFC1738に基づきURLエンコードを行う</refpurpose>
   </refnamediv>
   <refsect1>
    <title>説明</title>
     <methodsynopsis>
      <type>string</type><methodname>rawurlencode</methodname>
      <methodparam><type>string</type><parameter>str</parameter></methodparam>
     </methodsynopsis>
    <para>
     <screen>-_.</screen>を除くすべての非アルファベット文字をパーセン
     ト記号 (<literal>%</literal>)に続いて2つの16進数がある表現形式に
     置き換えた文字列を返します。これは、文字定数が特殊なURLデリミタと
     して解釈されたり、URL デリミタが(いくつかの電子メールシステムのよ
     うな)転送メディアにより文字変換されて失われてしまったりすることが
     ないように、RFC1738で定められたエンコーディング方法です。たとえば、
     FTP のURLに中にパスワードを埋め込みたい場合は以下のようにします。
     <example>
      <title><function>rawurlencode</function> の例1</title>
      <programlisting role="php">
<![CDATA[
echo '<a href="ftp://user:', rawurlencode('foo @+%/'),
     '@ftp.my.com/x.txt">';
]]>
      </programlisting>
     </example>
     また、URLの一部としてパス情報を渡す場合は、
     <example>
      <title><function>rawurlencode</function> の例2</title>
      <programlisting role="php">
<![CDATA[
echo '<a href="http://x.com/department_list_script/',
    rawurlencode('sales and marketing/Miami'), '">';
]]>
      </programlisting>
     </example>
     のようにします。
    </para>
    <simpara>
     <function>rawurldecode</function>, 
     <function>urldecode</function>,
     <function>urlencode</function>も参照下さい。
    </simpara>
   </refsect1>
  </refentry>

  <refentry id="function.urldecode">
   <refnamediv>
    <refname>urldecode</refname>
    <refpurpose>エンコードされたURL文字列のデコード</refpurpose>
   </refnamediv>
   <refsect1>
    <title>説明</title>
     <methodsynopsis>
      <type>string</type><methodname>urldecode</methodname>
      <methodparam><type>string</type><parameter>str</parameter></methodparam>
     </methodsynopsis>
    <para>
     与えられた文字列中のあらゆるエンコード文字
     <literal>%<replaceable>##</replaceable></literal>をデコードします。
     デコードされた文字列が返ります。
     <example>
      <title><function>urldecode</function>の使用例</title>
      <programlisting role="php">
<![CDATA[
$a = explode('&', $QUERY_STRING);
$i = 0;
while ($i < count($a)) {
    $b = split('=', $a[$i]);
    echo 'Value for parameter ', htmlspecialchars(urldecode($b[0])),
         ' is ', htmlspecialchars(urldecode($b[1])), "<br />\n";
    $i++;
}
]]>
      </programlisting>
     </example>
    </para>
     <para>
     <function>urlencode</function>、<function>rawurlencode</function>、
     <function>rawurldecode</function>も参考にしてください。
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.urlencode">
   <refnamediv>
    <refname>urlencode</refname>
    <refpurpose>URL文字列のエンコード</refpurpose>
   </refnamediv>
   <refsect1>
    <title>説明</title>
     <methodsynopsis>
      <type>string</type><methodname>urlencode</methodname>
      <methodparam><type>string</type><parameter>str</parameter></methodparam>
     </methodsynopsis>
    <para>
     <literal>-_.</literal>を除くすべての非英数文字が、%記号
     (<literal>%</literal>)に続く二桁の数字で置き換えられ、
     空白は+記号(<literal>+</literal>)にエンコードされます。
     同様の方法で、WWWのフォームからポストされたデータはエンコード
     され、<literal>application/x-www-form-urlencoded</literal>
     メディア型も同様です。RFC1738エンコード(
     <function>rawurlencode</function>を参照してください)との
     違いは、歴史的な理由で、空白が+記号にエンコードされることです。
     本関数は、URLの問い合わせ部分に使用する文字列のエンコードや
     次のページへ変数を渡すのに便利です。
     <example>
      <title><function>urlencode</function>の使用例</title>
      <programlisting role="php">
<![CDATA[
echo '<a href="mycgi?foo=', urlencode($userinput), '">';
]]>
      </programlisting>
     </example>
    </para>
    <note>
     <para>
      HTMLエンティティにマッチする変数については注意が必要です。
      &amp;amp、&amp;copy、&amp;poundのようなものがブラウザから送信さ
      れた場合、エンティティの実体が望ましい変数名の代わりに使用されま
      す。これは明らかな問題点であり、W3Cが何年も指摘し続けてきたこと
      です。リファレンスは、<ulink
      url="&url.argsep;">&url.argsep;</ulink>にあります。PHPでは、
      .ini ディレクティブのarg_separatorにより引数のセパレータをW3Cが
      推奨するセミコロンに変更することが可能です。残念なことに多くのユー
      ザエージントは、このセミコロン区切り形式でデータを送信しません。
      よりポータブルな方法としては、セパレータに&amp; の代わりに
      &amp;amp; を使用するというものがあります。この場合、PHPの
      arg_separatorを変更する必要はありません。セパレータは $amp; の
      ままにしますが、URLは
      <function>htmlentities</function>(urlencode($data))によりエンコー
      ドして下さい。
      <example>
       <title><function>urlencode/htmlentities</function>の例</title>
       <programlisting role="php">
<![CDATA[
echo '<a href="mycgi?foo=', htmlentities(urlencode($userinput)), '">';
]]>
       </programlisting>
      </example>
     </para>
    </note>
    <para>
     <function>urldecode</function>,
     <function>htmlentities</function>,
     <function>rawurldecode</function>,
     <function>rawurlencode</function>も参考にしてください。
    </para>
   </refsect1>
  </refentry>

 </reference>

<!-- 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:
-->