关于用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 /> ?>
<?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 /> ?>