验证消息cakephp错误?

时间:2016-11-09 08:08:42

标签: validation message

如何在cakephp中自定义消息验证,如??? ???

$value=$this->data['value'];
'count_device' => array(
                    'rule' => 'checkvalues',
                    'message' =>'Value must be greater than or equal to'.$value;
                   ));

消息是错误如何修复????

1 个答案:

答案 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;
        }
    }