/**
*
* 检查utf-8编码的字符串是否包含中文
* @param $str
* @return bool
*/
function checkUtf8StrIncludeCn($str){
$pattern = '/[\x{4e00}-\x{9fa5}]/u';
$result = preg_match($pattern,$str,$match);
return $result > 0 ? true : false;
}
php中双字节字符编码范围
GBK (GB2312/GB18030)
x00-xff GBK双字节编码范围
UTF-8 (Unicode)
u4e00-u9fa5 (中文) x3130-x318F
参考:
https://www.feiniaomy.com/post/312.html
https://www.cnblogs.com/zhuiluoyu/p/7423987.html
原文:https://www.cnblogs.com/zqsb/p/12188071.html