找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 2006|回复: 0
打印 上一主题 下一主题

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

[复制链接]

2500

主题

2513

帖子

7520

积分

论坛元老

Rank: 8Rank: 8

积分
7520
跳转到指定楼层
楼主
发表于 2018-2-14 06:01:13 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

            [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字符的方法
            
  • 分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
    收藏收藏
    回复

    使用道具 举报

    您需要登录后才可以回帖 登录 | 立即注册

    本版积分规则

    用户反馈
    客户端