function mb_is_utf8($string)
{
return mb_detect_encoding()($string, 'UTF-8') === 'UTF-8';//新发现
}
2、方法2
代码如下
复制代码
function preg_is_utf8($string)
{
return preg_match('/^.*$/u', $string) > 0;//preg_match('/^./u', $string)
}
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn