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 : { }
友情提示:垃圾评论一律封号 加我微信:826096331拉你进VIP群学习群