Home  >  Article  >  Backend Development  >  关于用thinkphp会员登录的表单自动验证的有关问题

关于用thinkphp会员登录的表单自动验证的有关问题

WBOY
WBOYOriginal
2016-06-13 12:40:21713browse

关于用thinkphp会员登录的表单自动验证的问题?
我的MemberAction代码是

<?php<br />
class MemberAction extends Action{<br />
    public function insert()<br />
	{<br />
	header('Content-Type:text/html; charset=utf-8');<br />
        $Member   =   D('developers');<br />
        if($Member->create()) {<br />
            $result =   $Member->add();<br />
            if($result) {<br />
                $this->success('注册成功!');<br />
            }else{<br />
                $this->error('注册失败!');<br />
            }<br />
        }else{<br />
            $this->error($Member->getError());<br />
        }<br />
    }<br />
 }<br />
?>


我的MemberModel代码是
<?php<br />
class 	MemberModel extends Model {<br />
    <br />
    protected $_validate    =   array(<br />
	    array("username","require","用户名不能为空"),<br />
		array('username','','帐号名称已经存在!',0,'unique',1),<br />
		array("username","checkLength","用户名长度不符合要求",0,'callback'),<br />
        array('name','require','名字必须'),<br />
		array("password","require","密码不能为空"),<br />
		array("password","checkLength","密码长度的要求是5~15位之间",0,'callback'),<br />
		array('repassword','password','两次密码输入不一致',0,'confirm'),<br />
        );<br />
    <br />
	 protected $_auto = array( <br />
        array('status', '1', self::MODEL_INSERT), <br />
        array('create_time', 'time', self::MODEL_INSERT, 'function'), <br />
    ); <br />
  <br />
}<br />
?>


问题是它不自动验证,不管你填什么都能注册成功,不填的话就是注册失败,不知道怎么回事,请教各位大大

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn