【问题标题】:Using route() and with() in html view in Laravel 5.6在 Laravel 5.6 的 html 视图中使用 route() 和 with()
【发布时间】:2019-11-21 05:33:12
【问题描述】:

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

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

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

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

【问题讨论】:

    标签: laravel laravel-5 laravel-routing


    【解决方案1】:

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

    【讨论】:

      猜你喜欢
      • 2019-01-28
      • 1970-01-01
      • 2018-09-26
      • 1970-01-01
      • 2019-02-28
      • 2018-09-28
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多