下面四种邮箱验证代码都是用正则做的,方法都可行,看你喜欢那一种.
-
- function funcemail($str)
- {
- return (preg_match('/^[_.0-9a-z-a-z-]+@([0-9a-z][0-9a-z-]+.)+[a-z]{2,4}$/',$str))?true:false;
- }
-
-
- $str="qbcd@126.com.cn";
- preg_match("/^[0-9a-z]+@(([0-9a-z]+)[.])+[a-z]{2,3}$/",$str,$re);
- print_r($re);
-
- if (eregi("^[_.0-9a-z-]+@([0-9a-z][0-9a-z-]+.)+[a-z]{2,3}$",$email)) {
- echo "您的 e-mail 通过初步检查";
- }
-
- if (ereg("/^[a-z]([a-z0-9]*[-_.]?[a-z0-9]+)*@([a-z0-9]*[-_]?[a-z0-9]+)+[.][a-z]{2,3}([.][a-z]{2})?$/i; ",$email)){
- echo "your email address is correct!";}
- else{
- echo "please try again!";
- }
|