php判断utf-8字符是否是中文?

使用正则表达式,比如下面判断$username是否完全是中文:

preg_match("/^[\x{4e00}-\x{9fa5}]+$/u", $username);

Posted in  php


blog comments powered by Disqus
Fork me on GitHub