-
Notifications
You must be signed in to change notification settings - Fork 105
/
Copy pathmb-detect-order.xml
164 lines (154 loc) · 4.76 KB
/
mb-detect-order.xml
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
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<!-- EN-Revision: 92f1b8b177eb5730382abf9f27bae868f1bb636f Maintainer: daijie Status: ready -->
<!-- CREDITS: mowangjuanzi -->
<refentry xml:id="function.mb-detect-order" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>mb_detect_order</refname>
<refpurpose>设置/获取 字符编码的检测顺序</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type class="union"><type>array</type><type>bool</type></type><methodname>mb_detect_order</methodname>
<methodparam choice="opt"><type class="union"><type>array</type><type>string</type><type>null</type></type><parameter>encoding</parameter><initializer>&null;</initializer></methodparam>
</methodsynopsis>
<para>
为编码列表 <parameter>encoding</parameter> 设置自动检测字符编码的顺序。
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>encoding</parameter></term>
<listitem>
<para>
<parameter>encoding</parameter> 是一个 <type>array</type> 或者逗号分隔的字符编码列表。
参见<link
linkend="mbstring.supported-encodings">支持的编码</link>。
</para>
<para>
如果省略 <parameter>encoding</parameter> 或为 &null;,它将返回当前字符编码检测顺序的数组。
</para>
<para>
该设置会影响 <function>mb_detect_encoding</function> 和 <function>mb_send_mail</function>。
</para>
<para>
<literal>mbstring</literal> 当前实现了以下编码检测筛选器。
如有以下编码列表的无效字节序列,编码的检测将会失败。
</para>
<simpara>
<literal>UTF-8</literal>, <literal>UTF-7</literal>,
<literal>ASCII</literal>,
<literal>EUC-JP</literal>,<literal>SJIS</literal>,
<literal>eucJP-win</literal>, <literal>SJIS-win</literal>,
<literal>JIS</literal>, <literal>ISO-2022-JP</literal>
</simpara>
<para>
对于 <literal>ISO-8859-*</literal>,<literal>mbstring</literal>
总是检测为 <literal>ISO-8859-*</literal>。
</para>
<para>
对于 <literal>UTF-16</literal>、<literal>UTF-32</literal>、
<literal>UCS2</literal> 和 <literal>UCS4</literal>,编码检测总是会失败。
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
设置编码检测顺序时候,成功时返回 &true;,识别时候返回 &false;。
</para>
<para>
在获取编码检测顺序的时候,会返回排序过的编码数组。
</para>
</refsect1>
<refsect1 role="changelog">
&reftitle.changelog;
<informaltable>
<tgroup cols="2">
<thead>
<row>
<entry>&Version;</entry>
<entry>&Description;</entry>
</row>
</thead>
<tbody>
&mbstring.changelog.encoding-nullable;
</tbody>
</tgroup>
</informaltable>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title><function>mb_detect_order</function> 示例</title>
<programlisting role="php">
<![CDATA[
<?php
/* 为检测顺序设置枚举列表 */
mb_detect_order("eucjp-win,sjis-win,UTF-8");
/* 通过数组设置检测顺序 */
$ary[] = "ASCII";
$ary[] = "JIS";
$ary[] = "EUC-JP";
mb_detect_order($ary);
/* 显示当前的检测顺序 */
echo implode(", ", mb_detect_order());
?>
]]>
</programlisting>
</example>
</para>
<para>
<example>
<title>案例展示了无效的检测顺序</title>
<programlisting>
<![CDATA[
; 总是检测为 ISO-8859-1
detect_order = ISO-8859-1, UTF-8
; 总是检测为 UTF-8,由于 ASCII/UTF-7 的值对 UTF-8 是有效的
detect_order = UTF-8, ASCII, UTF-7
]]>
</programlisting>
</example>
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><function>mb_internal_encoding</function></member>
<member><function>mb_http_input</function></member>
<member><function>mb_http_output</function></member>
<member><function>mb_send_mail</function></member>
</simplelist>
</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:"~/.phpdoc/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
-->