这家伙有点懒,还没写个性签名!
自定义一个规则: public function compareByEnd($attribute,$params) { if (time($this->startDate)>time($this->endDate)) { $this->addError($attribute, "wrong startDate"); } } 然后在你的规则数组中添加一句: [['startDate'],'compareByEnd'], 我没有验证正确性,你试一下。
自定义一个规则:
public function compareByEnd($attribute,$params) { if (time($this->startDate)>time($this->endDate)) { $this->addError($attribute, "wrong startDate"); } }
然后在你的规则数组中添加一句:
[['startDate'],'compareByEnd'],
我没有验证正确性,你试一下。
谢谢,可行。
解决了吗.
解决了,楼上那样就可以