mb_check_encoding
(PHP 4 >= 4.4.3, PHP 5 >= 5.1.3, PHP 7, PHP 8)
mb_check_encoding — 检查字符串在指定的编码里是否有效
说明
mb_check_encoding(string
$var
= null
, string $encoding
= mb_internal_encoding()): bool检查指定的字节流在指定的编码里是否有效。它能有效避免所谓的“无效编码攻击(Invalid Encoding Attack)”。
参数
-
var
-
要检查的字节流。如果省略了这个参数,此函数会检查所有来自最初请求所有的输入。
-
encoding
-
期望的编码。
返回值
成功时返回 true
, 或者在失败时返回 false
。

User Contributed Notes
There are no user contributed notes for this page.
备份地址:http://www.lvesu.com/blog/php/function.mb-check-encoding.php