PHP判断是否都是中文

 1 /**
 2  * 判断是否都是中文
 3  * @param $str
 4  * @return int
 5  */
 6 public static function IsAllChinese($str)
 7 {
 8     $len = preg_match('/^[\x{4e00}-\x{9fa5}]+$/u',$str);
 9     if ($len)
10     {
11         return true;
12     }
13     return false;
14 }

posted on 2016-06-23 11:03  diguaer  阅读(2904)  评论(0编辑  收藏  举报

导航