email 验证方式

js函数:

function isEmail(str){
        if(!/^[A-Za-z0-9]+([._/-/+]*[A-Za-z0-9]+)*@([A-Za-z0-9]+[-A-Za-z0-9]*[A-Za-z0-9]+/.)+[A-Za-z0-9]{2,4}$/.test(str)){
                return false;
        }
        return true;
}

php函数

    public function run($str){
                if(eregi("^[_.0-9a-z+-]+@([0-9a-z][0-9a-z-]+.)+[a-z]{2,4}$",$str)){
                        return true;
                }else{
                        return false;
                }
        }

猜你喜欢

转载自blog.csdn.net/wccczxm/article/details/4346699