在 html 中使用 route() 和 with() 在 Laravel 5.6 中查看

Using route() and with() in html view in Laravel 5.6

对于重定向,在控制器中,我们可以这样写:-

Redirect::Route('front_index')->with('RegError', 'An error occured while adding the user.');

如何设置锚标签的 href 以便我也可以发送 'RegError'?说这样的话?

<a href="{{route('front_index')->with('RegError', '')}}">

实际上你不能,因为 with 函数用于将参数从控制器传递到视图,而 route 助手没有这个方法。 您需要发出请求并在控制器中传递您的 RegError