php 检查电子邮件函数(自写)

yipeiwu_com5年前PHP代码库

复制代码 代码如下:

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+.htaccess实现全站静态HTML文件GZIP压缩传输(一)

apache的强大终于超出了我的想象,仅仅蜻蜓点水般触及了一点php皮毛,这点皮毛就在我原有的知识库基础上爆炸开来,好像PN结的“雪崩击穿”一样,让我想到了多种技术结合无限的应用前景。...

php 中文处理函数集合

--- 空格 --- string GBspace(string) --------- 每个中文字之间加空格 string GBunspace(string) ------- 每个中文字...

php防止恶意刷新与刷票的方法

本文实例讲述了php防止恶意刷新与刷票的方法。分享给大家供大家参考。具体实现方法如下: 一般来说,恶意刷新就是不停的去刷新提交页面,导致出现大量无效数据,下面我们来总结一下php 防止恶...

php中unserialize返回false的解决方法

本文实例讲述了php中unserialize返回false的解决方法,分享给大家供大家参考。具体方法如下: php 提供serialize(序列化) 与unserialize(反序列化)...

PHP长连接实现与使用方法详解

本文实例讲述了PHP长连接实现与使用方法。分享给大家供大家参考,具体如下: 长连接技术(Long Polling) 在服务器端hold住一个连接, 不立即返回, 直到有数据才返回, 这就...