1、检验手机号
/**
* 判断手机格式是否正确
* @param $mobile
*/
function is_mobile($mobile) {
return preg_match('/1[3456789]{1}\d{9}$/',$mobile);
}
/**
* 校验手机格式
* @param $utfstr
*/
function check_email($phonenumber ='13712345678'){
$phonenumber =phonenumber ;
if(preg\_match("/^1\[34578\]{1}\\d{9}$/",$phonenumber)){
if(preg_match($pattern,$email)){
$remsg='是手机号码!';
}else{
$remsg='不是手机号码!';
}
return $remsg;
}
}
2、校验邮箱格式
/**
* 校验邮箱格式
* @param $utfstr
*/
function check_email($email='123@qq.com'){
$email=$email;
$pattern="/([a-z0-9]*[-_.]?[a-z0-9]+)*@([a-z0-9]*[-_]?[a-z0-9]+)+[.][a-z]{2,3}([.][a-z]{2})?/i";
if(preg_match($pattern,$email)){
$remsg='邮箱验证通过!';
}else{
$remsg='邮箱格式错误!';
}
return $remsg;
}
/**
* 判断email格式是否正确
* @param $email
*/
function is_email($email) {
return strlen($email) > 6 && preg_match("/^[\w\-\.]+@[\w\-\.]+(\.\w+)+$/", $email);
}
3、检查密码长度是否符合规定
/**
* 检查密码长度是否符合规定
*
* @param STRING $password
* @return TRUE or FALSE
*/
function is_password($password) {
$strlen = strlen($password);
if($strlen >= 6 && $strlen <= 20) return true;
return false;
}

© 版权声明
文章未经允许请勿转载。
THE END
暂无评论内容