codeIgniter 中是否有一个文件,我可以在其中编辑以便自定义表单验证消息?
我只想将它们放在项目符号列表中以占用更少的空间。
这是我用来输出错误消息的代码:
<div class="alert <?php echo $alert['alert_type']; ?> min-form">
<button type="button" class="close" data-dismiss="alert">x</button>
<h4><?php echo $alert['main_message']; ?></h4>
<?php echo $alert['sub_message']; ?>
</div>
基本上 $alert['sub_message']
只是从 CodeIgniter 的 validation_errors()
函数获取数据,该函数从表单输出验证错误。
最佳答案
您可以通过这种方式更改错误定界符:
<ul>
<?php echo validation_errors('<li>', '</li>'); ?>
</ul>
文档:https://www.codeigniter.com/user_guide/libraries/form_validation.html#changing-the-error-delimiters
对于 v3:https://www.codeigniter.com/userguide3/libraries/form_validation.html#changing-the-error-delimiters
关于php - 如何在 codeIgniter 中自定义表单验证错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11271558/