php正则判断大小写

    if(isset($userget)){
            $userzz = "/^([a-zA-Z])[_a-zA-Z0-9]+$|^[1-9][_a-zA-Z0-9]+$/";
            $userzzz = "/^[A-Z]+$/";
            preg_match($userzz, $getuserss, $userarr);  
            preg_match($userzzz, $userarr[1], $usera);   
        if ($userget == "") {   
            echo iconv("GBK","utf-8","用户名不能为空");
        }else 
        if (strlen($getuserss) < 3) {
            echo iconv("GBK", "utf-8", "用户名不能少于3个字符");
        }else if ($getuserss == $rows['user']) {
                echo iconv("GBK", "utf-8", "用户已存在");
            }else if ($userarr == true) {   //判断起始大小写
                if ($usera == true) {
                        echo iconv("GBK", "utf-8", "起始位不能大写");
                }
            }
            else {
                echo iconv("GBK","utf-8","用户名格式错误");
            }
        exit;   
        }

Leave a Reply

(will not be published)