判断用户名字长度

//判断中英混合字符串长度
function lengths($Name,$Min=4,$Max=16){
    $Name = preg_replace("/([\x{4e00}-\x{9fa5}])/iu",'  ',$Name);
    if (mb_strlen($Name,'utf8') < $Min || mb_strlen($Name,'utf8') > $Max) {
        return false;
    }
    return true;

}

  

posted @ 2018-10-25 15:56  刹那风华——  阅读(226)  评论(0编辑  收藏  举报