CodeIgniter的检查验证已运行且失败 [英] Check validation has run and failed with CodeIgniter
本文介绍了CodeIgniter的检查验证已运行且失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何检查表单验证已运行并失败?使用:
How can I check that form validation has run and failed? Using:
$this->form_validation->run() == FALSE
即使验证未运行,也将运行,即:首次加载表单时(空白状态)。我正在使用形式验证来显示单个错误。但是,我的表格很长,我想在表格顶部显示一条消息,内容如下:
Will run even if the validation hasn't run, ie: when the form is first loaded (blank state). I am using forma validation to show individual errors. However I have quite a long form and I'd like to also show a message at the top of the form, saying something like:
There were errors submitting the form, please check the individual errors below
以下的单个错误
推荐答案
这将执行以下操作:
if (validation_errors()) echo 'There have been errors...';
这篇关于CodeIgniter的检查验证已运行且失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文