no comments yet
06 Dec 2018

PHP正则判断字符串中有无中文字符

$str = 'jkkhfilsd7889sd,.ewg';

if(preg_match('/[\x7f-\xff]/', $str)){
 echo '字符串中有中文<br/>';
}else{
 echo '字符串中没有中文<br/>';
 }