时间:2021-07-01 10:21:17 帮助过:35人阅读
if(preg_match("/^13[0-9]{1}[0-9]{8}$|15[0189]{1}[0-9]{8}$|189[0-9]{8}$/",$mobilephone)){ //验证通过 }else{ //手机号码格式不对 }
JavaScript代码
$("#smForm").validate({ rules: { smMobilePhone: { required: true, digits:true, range:[13000000000,18999999999] } }, messages: { smMobilePhone: { required: "您没有填写手机号码", digits: "手机号码格式不对", range: "手机号长度或者格式不对", } }, preErrs : { }