cakePHP: how set error validation to input field manually in controller

后端 未结 6 403
南旧
南旧 2021-01-12 00:15

I want set error validation to input field manually in controller example:

  if ($remainTime < 30) {
      ..... set error validation in here (error: lim         


        
6条回答
  •  一生所求
    2021-01-12 00:51

    This can be achieved using the invalidate method that will flag the field as having an error:-

    $this->Model->invalidate('field_name', 'error message');
    

提交回复
热议问题