标签:
$email=‘fst_-gh@163.com‘; //$pattern=‘^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*$‘; //$pattern=‘^[_.0-9a-z-]+@([0-9a-z][0-9a-z-]+.)+[a-z]{2,3}$‘; $pattern=‘^[_.0-9a-z-]+@([0-9a-z]+.)+[a-z]{2,3}$‘; if (eregi($pattern,$email)) { echo "OK"; }else{ echo"err"; }
preg_match 邮箱验证方法 (以下三种方法都可以)
$pattern="/([A-Za-z0-9\_]+)\@([\w\-]+)\.([a-z]{2,3})/"; $pattern2="/(^[A-Za-z0-9\_]+)\@([0-9a-z][0-9a-z-]+)\.([a-z]{2,3}$)/"; $pattern3="/([\w\-]+\@[\w\-]+\.[a-z]{2,3}$)/"; if (preg_match($pattern3,$email)) { echo "emailok"; }
标签:
原文地址:http://www.cnblogs.com/vania/p/4424597.html