Ale*_*chi 3 redirect view laravel
create wizard完成后,我正在尝试将用户重定向回主页。
如果我在控制器中编写return view('main')->with('key'=>'data'),一切都很好,但是URL不会更改为,localhost:8080而是保持为'localhost:8080 / wizard / finish`。
如果我使用redirect('/')->with(['message' => 'Done.'])它重定向到主页,但是因为已经有一个Route::get('/','Controller'),控制器被触发,它返回我的默认主页,没有消息。
<div class="row">
<div class="col-12">
@if (isset($message))
<p align="center" style="color: red;"><strong>{{$message}}</strong></p>
@endif
</div>
</div>
Run Code Online (Sandbox Code Playgroud)
编辑:在MainPageController(映射到/)中有一个断点,我看到当重定向到/路由时会触发此控制器。因此,我失去了$message,因为MainPageController还会返回相同的视图,但是没有消息。
| 归档时间: |
|
| 查看次数: |
5287 次 |
| 最近记录: |