CodeIgniter - 如何检查validation_error数组中是否有任何内容 [英] CodeIgniter - How to check if there is anything in the validation_error array
本文介绍了CodeIgniter - 如何检查validation_error数组中是否有任何内容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如果在validation_errors()数组中有任何错误,但如果我执行类似
Im wanting to display a general error message if there are any errors in the validation_errors() array, but if i do something like
if(isset(validation_errors())) { echo 'error'; }
然后返回并说
致命错误:在写上下文中不能使用函数返回值
Fatal error: Can't use function return value in write context
任何帮助将是盛大的。
Cheer,
Cheers,
推荐答案
if(validation_errors() != false) { echo 'error'; }
isset
用于确定变量已设置且不为NULL
isset
is used to Determine if a variable is set and is not NULL
阅读 http:/ /php.net/manual/en/function.isset.php
这篇关于CodeIgniter - 如何检查validation_error数组中是否有任何内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文