[代码][PHP]代码
1 |
if (preg_match( "/^13[0-9]{1}[0-9]{8}$|15[0189]{1}[0-9]{8}$|189[0-9]{8}$/" , $mobilephone )){ |
2 |
//验证通过 |
3 |
4
}
else
{
5 | //手机号码格式不对 |
6
7 | } |
[代码][JavaScript]代码
原文链接:https://www.f2er.com/regex/363041.html01 | $("#smForm" ).validate({ |
02
rules: {
03 | smMobilePhone: { |
04
required:
},monospace!important; font-size:10pt!important; min-height:auto!important; display:block!important">09
messages: {
true
05
digits:06
range:[13000000000,18999999999]
07
}
08
10
smMobilePhone: {
11 | required:"您没有填写手机号码" 12 |
digits:"手机号码格式不对" 13 |
range:"手机号长度或者格式不对" 14 |
} |
15 | 16 | preErrs : { |
17 | 18 | } |