//验证电话
private function reg_phone($phone){
if (preg_match("/^13[0-9]{1}[0-9]{8}$|15[0189]{1}[0-9]{8}$|189[0-9]{8}$/",$phone)) {
return true;
} else{
return false;
}
}
//验证邮箱
private function check_email($mail){
if(preg_match('/^[\w\-\.]+@[\w\-\.]+(\.\w+)+$/', $mail)){
return true;
}else{
return false;
}
}
private function reg_phone($phone){
if (preg_match("/^13[0-9]{1}[0-9]{8}$|15[0189]{1}[0-9]{8}$|189[0-9]{8}$/",$phone)) {
return true;
} else{
return false;
}
}
//验证邮箱
private function check_email($mail){
if(preg_match('/^[\w\-\.]+@[\w\-\.]+(\.\w+)+$/', $mail)){
return true;
}else{
return false;
}
}
验证身份证号(15位或18位数字)
|
//验证身份证号(15位或18位数字)
function preg_idcard($idcard) {
if(preg_match("/^\d{15}|\d{18}$/", $idcard)) {
return TRUE;
} else {
return FALSE;
}
}
|
腾讯QQ号验证
|
function preg_qq($qq) {
if(preg_match("/^[1-9][0-9]{4,}$/", $qq)) {
return TRUE;
} else {
return FALSE;
}
}
|
验证Email
|
function preg_email($email) {
if(preg_match("/^\w+[-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/", $email)) {
return TRUE;
} else {
return FALSE;
}
}
|
用户名验证:
用户名验证规则:用户名只能由数字、字母、中文汉字及下划线组成,不能包含特殊符号。
|
function preg_email($user) {<br>if(preg_match('/^[A-Za-z0-9_\x{4e00}-\x{9fa5}]+$/u',$string)) {return TRUE;}else{return FALSE;}<br>}
|


版权声明:
原文链接: 
