PHP手机,邮箱正则匹配

/*此处用于验证手机*/
$phone_preg = '/^1[3|4|5|7|8]\d{9}$/';
$email_preg = '/^[a-zA-Z0-9_]+([.][a-zA-Z0-9_]+)*[@][a-zA-Z0-9_]+([.][a-zA-Z0-9_]+)*[.][a-zA-Z]{2,4}$/';
if( preg_match( $phone_preg, $username ) ){
$account_type = 'mobile_phone';
}elseif ( preg_match( $email_preg, $username ) ) {
$account_type = 'email';
}

上一篇:Java基础学习191223(异常捕获机制,自定义异常,GUI图形化编程,贪吃蛇)


下一篇:app_field.clear_dependent_fields