Validate类支持读取模型类的属性定义完成验证

This commit is contained in:
thinkphp
2016-03-07 18:02:02 +08:00
parent 440658b2e4
commit 7c1d29595b
2 changed files with 23 additions and 6 deletions

View File

@@ -1817,4 +1817,18 @@ class Model
}
return $sql;
}
/**
* 获取属性值
* @access protected
* @param string $property 属性名
* @return mixed
*/
public function getProperty($property)
{
if (property_exists($this, $property)) {
return $this->$property;
}
return null;
}
}