时时商务社区
标题:
php 检查电子邮件函数(自写)
[打印本页]
作者:
bewin83
时间:
2018-2-14 06:01
[U]复制代码[/U] 代码如下:
function is_valid_email_address($email){
$qtext = '[^//x0d//x22//x5c//x80-//xff]';
$dtext = '[^//x0d//x5b-//x5d//x80-//xff]';
$atom = '[^//x00-//x20//x22//x28//x29//x2c//x2e//x3a-//x3c'.
'//x3e//x40//x5b-//x5d//x7f-//xff]+';
$quoted_pair = '//x5c[//x00-//x7f]';
$domain_literal = "//x5b($dtext|$quoted_pair)*//x5d";
$quoted_string = "//x22($qtext|$quoted_pair)*//x22";
$domain_ref = $atom;
$sub_domain = "($domain_ref|$domain_literal)";
$word = "($atom|$quoted_string)";
$domain = "$sub_domain(//x2e$sub_domain)*";
$local_part = "$word(//x2e$word)*";
$addr_spec = "$local_part//x40$domain";
return preg_match("!^$addr_spec$!", $email) ? 1 : 0;
}
您可能感兴趣的文章:
php使用mb_check_encoding检查字符串在指定的编码里是否有效
PHP语法自动检查的Vim插件
PHP中使用SimpleXML检查XML文件结构实例
PHP和Shell实现检查SAMBA与NFS Server是否存在
php实现检查文章是否被百度收录
php实现字符串反转输出的方法
php从字符串创建函数的方法
php字符串分割函数用法实例
php检查字符串中是否包含7位GSM字符的方法
欢迎光临 时时商务社区 (http://bbs.4435.cn/)
Powered by Discuz! X3.2