php学习交流博客

好好写代码,好好痛她

php.验证是否是 email 地址

 

 1<?php
 2/*
 3Original script by Tobias Ratschiller.
 4
 5* top level domain must have at least 2 chars
 6* there can be more than one dot in the address
 7*/
 8
 9    function is_email($address) {
10      $rc1 = (ereg('^[-!#$%&'*+./0-9=?A-Z^_`a-z{|}~]+'.
11             '@'.
12             '[-!#$%&'*+\/0-9=?A-Z^_`a-z{|}~]+.'.
13             '[-!#$%&'*+\./0-9=?A-Z^_`a-z{|}~]+$',
14             $address));
15      $rc2 = (preg_match('/.+.ww+$/',$address));
16      return ($rc1 && $rc2);
17    }
18?>

posted on 2010-02-26 20:05 王吉刚 阅读(635) 评论(0)  编辑 收藏 引用 网摘 所属分类: php学习转载区


只有注册用户登录后才能发表评论。
网站导航: