从控制器重定向后在 Laravel 中显示错误消息
问题描述
如何在 Laravel 中重定向的视图中显示验证消息?
这是我在控制器中的功能
我知道下面给出的代码是一个不好的尝试,但我该如何解决它,什么是我错过了
更新:以及如何在特定字段附近显示错误消息
Laravel 4
当验证失败时返回验证错误.
您可以使用
在您的视图中捕获错误更新
要在每个字段下显示错误,您可以这样做.
使用 css 获得更好的显示样式.
您可以在这里参考文档.p>
更新 2
一次显示所有错误
在每个字段下显示错误.
How can I display the validation message in the view that is being redirected in Laravel ?
Here is my function in a Controller
I know the below given code is a bad try, But how can I fix it and what am I missing
Update : And how do I display the error messages near to the particular fields
Laravel 4
When the validation fails return back with the validation errors.
You can catch the error on your view using
UPDATE
To display error under each field you can do like this.
For better display style with css.
You can refer to the docs here.
UPDATE 2
To display all errors at once
To display error under each field.
这篇关于从控制器重定向后在 Laravel 中显示错误消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!