我正在Codeigniter 3.1.8中开发一个基本的博客应用程序。
该应用程序具有注册表。您必须接受条款和条件才能注册。
我有以下评估规则:
$this->form_validation->set_rules('terms', 'Terms and Conditions', 'required');
上一行的问题是,它输出标准错误消息“必须提供“条款和条件”字段”,而我希望“您必须接受条款和条件”。
我该如何实现?
最佳答案
您可以在文档中找到答案:
$this->form_validation->set_rules('field_name', 'Field Label', 'rule1|rule2|rule3',
array('rule2' => 'Error Message on rule2 for this field_name')
);
然后在您的代码上,您应该具有以下内容:
$this->form_validation->set_rules('terms', 'Terms and Conditions', 'required', array ('required' => 'You must accept the Terms and Conditions'));
关于codeigniter - 在Codeigniter 3中设置非标准验证错误消息,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52464797/