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 }