无法在Codeigniter中显示is_unique的自定义错误消息

时间:2019-05-27 09:51:10

标签: codeigniter validation

我正在使用这些form_validation规则来显示重复条目的错误消息,但是会显示默认错误消息。

$this->form_validation->set_rules('email', 
                                  'Email',                                      
                                  'required|is_unique[users.email]',
                                  'A User is already registered with this E-mail');

1 个答案:

答案 0 :(得分:1)

请检查以下内容:

$this->form_validation->set_rules(
        'email', 'Email',
        'required|is_unique[users.email]',
        array(
                'is_unique'     => 'A User is already registered with this E-mail : %s'
        )
);