哪位大神懂yii2自定义验证规则的:
比如数据表字段中判断最大值不能小于最小值,
public function validateMultipleax_credits($attribute, $params)
{
if([$this->max_credits] >= [$this->min_credits]) {
return $this->max_credits;
}
return $this->min_credits;
}
请问我是哪里错了?
看看这里是否能解决你的问题,http://blog.csdn.net/cjqh_hao/article/details/52028957