uTools-Manuals/docs/php/idn_to_utf8.html
2019-04-28 19:00:34 +08:00

186 lines
6.1 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>Convert domain name from IDNA ASCII to Unicode</title>
</head>
<body class="docs"><div id="layout">
<div id="layout-content"><div id="function.idn-to-utf8" class="refentry">
<div class="refnamediv">
<h1 class="refname">idn_to_utf8</h1>
<p class="verinfo">(PHP 5 &gt;= 5.3.0, PHP 7, PECL intl &gt;= 1.0.2, PECL idn &gt;= 0.1)</p><p class="refpurpose"><span class="refname">idn_to_utf8</span> &mdash; <span class="dc-title">Convert domain name from IDNA ASCII to Unicode</span></p>
</div>
<div class="refsect1 description" id="refsect1-function.idn-to-utf8-description">
<h3 class="title">说明</h3>
<p class="para">过程化风格</p>
<div class="methodsynopsis dc-description">
<span class="methodname"><strong>idn_to_utf8</strong></span>
( <span class="methodparam"><span class="type">string</span> <code class="parameter">$domain</code></span>
[, <span class="methodparam"><span class="type">int</span> <code class="parameter">$options</code><span class="initializer"> = IDNA_DEFAULT</span></span>
[, <span class="methodparam"><span class="type">int</span> <code class="parameter">$variant</code><span class="initializer"> = INTL_IDNA_VARIANT_UTS46</span></span>
[, <span class="methodparam"><span class="type">array</span> <code class="parameter reference">&$idna_info</code></span>
]]] ) : <span class="type">string</span></div>
<p class="para rdfs-comment">
This function converts a Unicode domain name from an IDNA ASCII-compatible format to plain Unicode, encoded in UTF-8.
</p>
</div>
<div class="refsect1 parameters" id="refsect1-function.idn-to-utf8-parameters">
<h3 class="title">参数</h3>
<p class="para">
<dl>
<dt>
<code class="parameter">domain</code></dt>
<dd>
<p class="para">
Domain to convert in an IDNA ASCII-compatible format.
</p>
</dd>
<dt>
<code class="parameter">options</code></dt>
<dd>
<p class="para">
Conversion options - combination of IDNA_* constants
(except IDNA_ERROR_* constants).
</p>
</dd>
<dt>
<code class="parameter">variant</code></dt>
<dd>
<p class="para">
Either <strong><code>INTL_IDNA_VARIANT_2003</code></strong> for IDNA 2003 or
<strong><code>INTL_IDNA_VARIANT_UTS46</code></strong> for UTS #46.
</p>
</dd>
<dt>
<code class="parameter">idna_info</code></dt>
<dd>
<p class="para">
This parameter can be used only if
<strong><code>INTL_IDNA_VARIANT_UTS46</code></strong> was used for
<code class="parameter">variant</code>. In that case, it will be filled with an
array with the keys <em>&#039;result&#039;</em>, the possibly illegal
result of the transformation,
<em>&#039;isTransitionalDifferent&#039;</em>, a boolean indicating
whether the usage of the transitional mechanisms of UTS #46 either has
or would have changed the result and <em>&#039;errors&#039;</em>,
which is an <span class="type"><a href="language.types.integer.html" class="type int">int</a></span> representing a bitset of the error
constants IDNA_ERROR_*.
</p>
</dd>
</dl>
</p>
</div>
<div class="refsect1 returnvalues" id="refsect1-function.idn-to-utf8-returnvalues">
<h3 class="title">返回值</h3>
<p class="para">
The domain name in Unicode, encoded in UTF-8, 或者在失败时返回 <strong><code>FALSE</code></strong>
</p>
</div>
<div class="refsect1 changelog" id="refsect1-function.idn-to-utf8-changelog">
<h3 class="title">更新日志</h3>
<p class="para">
<table class="doctable informaltable">
<thead>
<tr>
<th>版本</th>
<th>说明</th>
</tr>
</thead>
<tbody class="tbody">
<tr>
<td>7.4.0</td>
<td>
The default value of <code class="parameter">variant</code> is now
<strong><code>INTL_IDNA_VARIANT_UTS46</code></strong> instead of the deprecated
<strong><code>INTL_IDNA_VARIANT_2003</code></strong>.
</td>
</tr>
<tr>
<td>7.2.0</td>
<td>
<strong><code>INTL_IDNA_VARIANT_2003</code></strong> has been deprecated; use
<strong><code>INTL_IDNA_VARIANT_UTS46</code></strong> instead.
</td>
</tr>
<tr>
<td>5.4.0/PECL 2.0.0b1</td>
<td>
Added the parameters <code class="parameter">variant</code> and
<code class="parameter">idna_info</code>; UTS #46 support (requires ICU ≥ 4.6).
</td>
</tr>
</tbody>
</table>
</p>
</div>
<div class="refsect1 examples" id="refsect1-function.idn-to-utf8-examples">
<h3 class="title">范例</h3>
<div class="example" id="example-3103">
<p><strong>Example #1 <span class="function"><strong>idn_to_utf8()</strong></span> example</strong></p>
<div class="example-contents">
<div class="phpcode"><pre><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br /><br /></span><span style="color: #007700">echo&nbsp;</span><span style="color: #0000BB">idn_to_utf8</span><span style="color: #007700">(</span><span style="color: #DD0000">'xn--tst-qla.de'</span><span style="color: #007700">);&nbsp;<br /><br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</pre></div>
</div>
</div>
<p class="para">以上例程会输出:</p>
<div class="example-contents screen">
<div class="cdata"><pre>
täst.de
</pre></div>
</div>
</div>
<div class="refsect1 seealso" id="refsect1-function.idn-to-utf8-seealso">
<h3 class="title">参见</h3>
<p class="para">
<ul class="simplelist">
<li class="member"><span class="function"><a href="idn_to_ascii.html" class="function" rel="rdfs-seeAlso">idn_to_ascii()</a> - Convert domain name to IDNA ASCII form</span></li>
</ul>
</p>
</div>
</div></div></div></body></html>