开发者

CodeIgniter - How to check if there is anything in the validation_error array

I'm 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'; }

then it returns back and says:

Fa开发者_JS百科tal error: Can't use function return value in write context

Any help would be grand.


if(validation_errors() != false) { echo 'error'; }

isset is used to Determine if a variable is set and is not NULL

Read http://php.net/manual/en/function.isset.php


Just echo vadidation_errors()

It will output if there are errors, and nothing if no errors. You don't need if

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜