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

74 lines
2.4 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-check-encoding" class="refentry">
<div class="refnamediv">
<h1 class="refname">mb_check_encoding</h1>
<p class="verinfo">(PHP 4 &gt;= 4.4.3, PHP 5 &gt;= 5.1.3, PHP 7)</p><p class="refpurpose"><span class="refname">mb_check_encoding</span> &mdash; <span class="dc-title">检查字符串在指定的编码里是否有效</span></p>
</div>
<div class="refsect1 description" id="refsect1-function.mb-check-encoding-description">
<h3 class="title">说明</h3>
<div class="methodsynopsis dc-description">
<span class="methodname"><strong>mb_check_encoding</strong></span>
([ <span class="methodparam"><span class="type">string</span> <code class="parameter">$var</code><span class="initializer"> = <strong><code>NULL</code></strong></span></span>
[, <span class="methodparam"><span class="type">string</span> <code class="parameter">$encoding</code><span class="initializer"> = mb_internal_encoding()</span></span>
]] ) : <span class="type">bool</span></div>
<p class="para rdfs-comment">
检查指定的字节流在指定的编码里是否有效。它能有效避免所谓的“无效编码攻击Invalid Encoding Attack”。
</p>
<p class="para">
</p>
</div>
<div class="refsect1 parameters" id="refsect1-function.mb-check-encoding-parameters">
<h3 class="title">参数</h3>
<p class="para">
<dl>
<dt>
<code class="parameter">var</code></dt>
<dd>
<p class="para">
要检查的字节流。如果省略了这个参数,此函数会检查所有来自最初请求所有的输入。
</p>
</dd>
<dt>
<code class="parameter">encoding</code></dt>
<dd>
<p class="para">
期望的编码。
</p>
</dd>
</dl>
</p>
</div>
<div class="refsect1 returnvalues" id="refsect1-function.mb-check-encoding-returnvalues">
<h3 class="title">返回值</h3>
<p class="para">
成功时返回 <strong><code>TRUE</code></strong> 或者在失败时返回 <strong><code>FALSE</code></strong>
</p>
</div>
</div></div></div></body></html>