/*此处用于验证手机*/
$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‘;
}
时间: 2024-09-29 09:20:44