ThinkChat🤖让你学习和工作更高效,注册即送10W Token,即刻开启你的AI之旅 广告
~~~ if (! function_exists('is_zh_text')) { /** * @param $text * @return bool */ function is_zh_text($text) :bool { $pattern = "/[^\x{4E00}-\x{9FFF}]+/u"; $newStr = preg_replace($pattern,'', $text); if($newStr===''){ return false; echo "字符串中不包含中文<br>"; }else{ return true; echo "字符串中包含中文<br>"; } } } if (! function_exists('is_ug_text')) { /** * @param $text * @return bool */ function is_ug_text($text) :bool { $pattern = "/[\x{0600}-\x{06ff}]/u"; $res = preg_match($pattern,$text); if($res > 0){ return true; echo "字符串中包含维吾尔文<br>"; }else{ return false; echo "字符串中不包含维吾尔文<br>"; } } } ~~~