首页 > 代码库 > php 匹配中文(utf8)

php 匹配中文(utf8)

$username ="你好";$pattern             = ‘/^[\x{4e00}-\x{9fa5}]{2,20}$/u‘;$res                = preg_match($pattern,$username);var_dump($res);