字符串中是否有中文
$bool = preg_match('/^.*[\x4e00-\x9fa5]+.*$/', $str);
本文探讨了如何使用正则表达式在给定的字符串中查找包含中文字符的模式,通过实例展示了preg_match函数的应用。
$bool = preg_match('/^.*[\x4e00-\x9fa5]+.*$/', $str);
580
295
229

被折叠的 条评论
为什么被折叠?