mirror of
https://github.com/fofolee/uTools-Manuals.git
synced 2025-06-18 05:26:57 +08:00
186 lines
6.1 KiB
HTML
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 to IDNA ASCII form</title>
|
|
</head>
|
|
<body class="docs"><div id="layout">
|
|
<div id="layout-content"><div id="function.idn-to-ascii" class="refentry">
|
|
<div class="refnamediv">
|
|
<h1 class="refname">idn_to_ascii</h1>
|
|
<p class="verinfo">(PHP 5 >= 5.3.0, PHP 7, PECL intl >= 1.0.2, PECL idn >= 0.1)</p><p class="refpurpose"><span class="refname">idn_to_ascii</span> — <span class="dc-title">Convert domain name to IDNA ASCII form</span></p>
|
|
|
|
</div>
|
|
<div class="refsect1 description" id="refsect1-function.idn-to-ascii-description">
|
|
<h3 class="title">说明</h3>
|
|
<p class="para">过程化风格</p>
|
|
<div class="methodsynopsis dc-description">
|
|
<span class="methodname"><strong>idn_to_ascii</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 to an IDNA ASCII-compatible format.
|
|
</p>
|
|
</div>
|
|
|
|
|
|
<div class="refsect1 parameters" id="refsect1-function.idn-to-ascii-parameters">
|
|
<h3 class="title">参数</h3>
|
|
<p class="para">
|
|
<dl>
|
|
|
|
|
|
<dt>
|
|
<code class="parameter">domain</code></dt>
|
|
|
|
<dd>
|
|
|
|
<p class="para">
|
|
The domain to convert, which must be UTF-8 encoded.
|
|
</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>'result'</em>, the possibly illegal
|
|
result of the transformation,
|
|
<em>'isTransitionalDifferent'</em>, a boolean indicating
|
|
whether the usage of the transitional mechanisms of UTS #46 either has
|
|
or would have changed the result and <em>'errors'</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-ascii-returnvalues">
|
|
<h3 class="title">返回值</h3>
|
|
<p class="para">
|
|
The domain name encoded in ASCII-compatible form, 或者在失败时返回 <strong><code>FALSE</code></strong>
|
|
</p>
|
|
</div>
|
|
|
|
|
|
<div class="refsect1 changelog" id="refsect1-function.idn-to-ascii-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-ascii-examples">
|
|
<h3 class="title">范例</h3>
|
|
<div class="example" id="example-3102">
|
|
<p><strong>Example #1 <span class="function"><strong>idn_to_ascii()</strong></span> example</strong></p>
|
|
<div class="example-contents">
|
|
<div class="phpcode"><pre><span style="color: #000000">
|
|
<span style="color: #0000BB"><?php<br /><br /></span><span style="color: #007700">echo </span><span style="color: #0000BB">idn_to_ascii</span><span style="color: #007700">(</span><span style="color: #DD0000">'täst.de'</span><span style="color: #007700">); <br /><br /></span><span style="color: #0000BB">?></span>
|
|
</span>
|
|
</pre></div>
|
|
</div>
|
|
|
|
</div>
|
|
<p class="para">以上例程会输出:</p>
|
|
<div class="example-contents screen">
|
|
<div class="cdata"><pre>
|
|
xn--tst-qla.de
|
|
</pre></div>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
<div class="refsect1 seealso" id="refsect1-function.idn-to-ascii-seealso">
|
|
<h3 class="title">参见</h3>
|
|
<p class="para">
|
|
<ul class="simplelist">
|
|
<li class="member"><span class="function"><a href="idn_to_utf8.html" class="function" rel="rdfs-seeAlso">idn_to_utf8()</a> - Convert domain name from IDNA ASCII to Unicode</span></li>
|
|
</ul>
|
|
</p>
|
|
</div>
|
|
|
|
</div></div></div></body></html> |