<?php $str = "我是王铁锤子"; $reg = '/^[\x{4e00}-\x{9fa5}]{5}$/u'; $res = preg_match($reg,$str); var_dump($res); ?>