0
什么我想要做的是验证如果年龄不低于18岁或超过33的Kohana 3.2验证在生日
public function validate($arr) {
return Validation::factory($arr)
->rule('username', 'not_empty')
->rule('last_name', 'not_empty')
->rule('first_name', 'not_empty')
->rule('email', 'not_empty')
->rule('email', 'email_domain')
->rule('phone_num', 'not_empty')
->rule('birthdate', 'not_empty')
->rule('birthdate', array($this, 'check_birthday'));
}
public function check_birthday()
{
check if age is not under 18 or over 33
return boolean;
}
好吧,它的工作btw如何添加一个错误消息,如果它低于18或以上33? – GianFS
@MarkFs消息在消息文件夹中定义,在这种情况下使用方法名称 – Kemo