php 手机 密码正则验证
if(preg_match("/^134[0-8]\d{7}$|^13[^4]\d{8}$|^14[5-9]\d{8}$|^15[^4]\d{8}$|^16[6]\d{8}$|^17[0-8]\d{8}$|^18[\d]{9}$|^19[8,9]\d{8}$/",substr($_POST['userMobile'], -11))){ //验证通过 }else{ //手机号码格式不对 ?> <script> alert("手机号码格式不对"); window.history.go(-1); </script> <?php exit(); } if(preg_match("/^[a-z0-9]{4,16}$/",$_POST['loginPwd'])){ //验证通过 ---- 数字字母 }else{ //密码格式不对 ?> <script> alert("密码格式不对,请输入字母与数字的组合"); window.history.go(-1); </script> <?php exit(); }
浙公网安备 33010602011771号