自动注册模型类定义的rule规则

This commit is contained in:
thinkphp
2016-03-06 20:01:37 +08:00
parent 000140842f
commit e79b3322ce

View File

@@ -991,6 +991,9 @@ class Model
// 验证前清空error
$this->error = '';
if (!empty($this->options['validate'])) {
if (!empty($this->rule)) {
Validate::rule($this->rule);
}
if (!Validate::check($data, $this->options['validate'])) {
$this->error = Validate::getError();
return false;