uTools-Manuals/docs/php/mb_substitute_character.html
2019-04-08 23:22:26 +08:00

101 lines
5.1 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!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>设置/获取替代字符</title>
</head>
<body class="docs"><div id="layout">
<div id="layout-content"><div id="function.mb-substitute-character" class="refentry">
<div class="refnamediv">
<h1 class="refname">mb_substitute_character</h1>
<p class="verinfo">(PHP 4 &gt;= 4.0.6, PHP 5, PHP 7)</p><p class="refpurpose"><span class="refname">mb_substitute_character</span> &mdash; <span class="dc-title">设置/获取替代字符</span></p>
</div>
<div class="refsect1 description" id="refsect1-function.mb-substitute-character-description">
<h3 class="title">说明</h3>
<div class="methodsynopsis dc-description">
<span class="methodname"><strong>mb_substitute_character</strong></span>
([ <span class="methodparam"><span class="type"><a href="language.pseudo-types.html#language.types.mixed" class="type mixed">mixed</a></span> <code class="parameter">$substchar</code><span class="initializer"> = mb_substitute_character()</span></span>
] ) : <span class="type"><a href="language.pseudo-types.html#language.types.mixed" class="type mixed">mixed</a></span></div>
<p class="para rdfs-comment">
当输入字符的编码是无效的,或者字符代码不存在于输出的字符编码中时,可以为其指定一个替代字符。
无效字符可以被替换为 <strong><code>NULL</code></strong>(不输出)、<span class="type"><a href="language.types.string.html" class="type string">string</a></span> 或者 <span class="type"><a href="language.types.integer.html" class="type integer">integer</a></span>Unicode 字符代码的值)。
</p>
<p class="para">
该设置会影响 <span class="function"><a href="mb_convert_encoding.html" class="function">mb_convert_encoding()</a></span>
<span class="function"><a href="mb_convert_variables.html" class="function">mb_convert_variables()</a></span>
<span class="function"><a href="mb_output_handler.html" class="function">mb_output_handler()</a></span>
<span class="function"><a href="mb_send_mail.html" class="function">mb_send_mail()</a></span>
</p>
</div>
<div class="refsect1 parameters" id="refsect1-function.mb-substitute-character-parameters">
<h3 class="title">参数</h3>
<p class="para">
<dl>
<dt>
<code class="parameter">substchar</code></dt>
<dd>
<p class="para">
指定 Unicode 值为一个 <span class="type"><a href="language.types.integer.html" class="type integer">integer</a></span>,或者是以下<span class="type"><span class="type 字符串">字符串</span></span>中的一个:
<ul class="itemizedlist">
<li class="listitem">
<span class="simpara">
<em>&quot;none&quot;</em>::不输出
</span>
</li>
<li class="listitem">
<span class="simpara">
<em>&quot;long&quot;</em>:输出字符代码的值(比如:<em>U+3000</em><em>JIS+7E7E</em>
</span>
</li>
<li class="listitem">
<span class="simpara">
<em>&quot;entity&quot;</em>:输出字符的实体(比如:<em>&amp;#x200;</em>
</span>
</li>
</ul>
</p>
</dd>
</dl>
</p>
</div>
<div class="refsect1 returnvalues" id="refsect1-function.mb-substitute-character-returnvalues">
<h3 class="title">返回值</h3>
<p class="para">
如果设置了 <code class="parameter">substchar</code>,在成功时返回 <strong><code>TRUE</code></strong>,失败时返回 <strong><code>FALSE</code></strong>
如果没有设置 <code class="parameter">substchar</code>,它将返回当前设置。
</p>
</div>
<div class="refsect1 examples" id="refsect1-function.mb-substitute-character-examples">
<h3 class="title">范例</h3>
<p class="para">
<div class="example" id="example-3197">
<p><strong>Example #1 <span class="function"><strong>mb_substitute_character()</strong></span> 例子</strong></p>
<div class="example-contents">
<div class="phpcode"><pre><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br /></span><span style="color: #FF8000">/*&nbsp;设置为&nbsp;Unicode&nbsp;U+3013&nbsp;(GETA&nbsp;MARK)&nbsp;*/<br /></span><span style="color: #0000BB">mb_substitute_character</span><span style="color: #007700">(</span><span style="color: #0000BB">0x3013</span><span style="color: #007700">);<br /><br /></span><span style="color: #FF8000">/*&nbsp;设置十六进制格式&nbsp;*/<br /></span><span style="color: #0000BB">mb_substitute_character</span><span style="color: #007700">(</span><span style="color: #DD0000">"long"</span><span style="color: #007700">);<br /><br /></span><span style="color: #FF8000">/*&nbsp;显示当前设置&nbsp;*/<br /></span><span style="color: #007700">echo&nbsp;</span><span style="color: #0000BB">mb_substitute_character</span><span style="color: #007700">();<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</pre></div>
</div>
</div>
</p>
</div>
</div></div></div></body></html>