如何在cakephp中自定义消息验证,如??? ???
$value=$this->data['value'];
'count_device' => array(
'rule' => 'checkvalues',
'message' =>'Value must be greater than or equal to'.$value;
));
消息是错误如何修复????
答案 0 :(得分:0)
尝试这样,
$value=$this->data['value'];
'count_device' => array(
'rule' => 'checkvalues',
'message' =>'Value must be greater than or equal to'.$value;
));
public function checkvalues($value,$context){
if($context['data']['count_device'] > $value) {
return false;
} else {
return true;
}
}