如何在登录后重定向返回页面?在 Laravel 5.2 中
授权 Controller
protected $redirectTo = '/';
重定向用户
<?php
namespace Illuminate\Foundation\Auth;
trait RedirectsUsers
{
/**
* Get the post register / login redirect path.
*
* @return string
*/
public function redirectPath()
{
if (property_exists($this, 'redirectPath')) {
return $this->redirectPath;
}
return property_exists($this, 'redirectTo') ? $this->redirectTo : '/';
}
}
最佳答案
您可以使用这两个选项中的任何一个来完成。
- 返回重定向::返回();这会将用户带回到他/她来自的页面。
- return redirect('在这里输入你的路线');这会将用户带到您使用该特定路线定义的 View 。
关于php - Laravel 登录后重定向回来,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39770231/