2 u010990330 u010990330 于 2014.10.28 22:53 提问

thinkphp自动验证的问题

我这样写有问题吗请帮吗改正?
class UserModel extends Model{
protected $_validate=array(
array("username","require","用户名不能为空"),
array("pasword","require","密码不能为空"),
array("username,pasword","login","用户名不存在",1,"callback",3),
);
protected function login($date)
{
$m = M(User);
$where['password']=$date["pasword"];
$a = $m->where($where)->field("usename")->select();
if(count($a)>0)
{

for($i=0; $i<count($a); $i++)
{
if($a[$i]["usename"]==$date["username"])
{

return true;
}
}
}
else {
return false;
}
}
}

Csdn user default icon
上传中...
上传图片
插入图片