email 验证方式

来源:互联网 发布:淘宝男装冬装西服 编辑:程序博客网 时间:2024/06/06 13:56

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;
                }
        }

原创粉丝点击