注销时如何更改重定向URL?

问题描述:

我正在使用默认提供的Laravel 5身份验证系统. 注销后,用户将重定向到根页面,但我想更改它. 通过在"AuthController.php"中定义"$ redirectTo",我成功地完成了登录"和注册"过程.但是对于注销",我在同一位置定义了"$ redirectAfterLogout",但似乎没有考虑到它.

I'm working with Laravel 5 authentification system provided by default. After logging out, a user is redirected to the root page but I'd like to change that. I managed to do it for the "login" and "registering" process by defining "$redirectTo" in "AuthController.php". But for "logout", I defined "$redirectAfterLogout" at the same place but it seems to not be taken into account.

有人可以向我解释问题出在哪里以及如何解决它吗? 非常感谢.

Could anyone explain me where is the problem and how to fix it please? Thanks a lot.

对于Laravel 5,

For Laravel 5,

打开AuthController类:app/Http/Controllers/Auth/AuthController.php

Open AuthController class : app/Http/Controllers/Auth/AuthController.php

将以下属性添加到类

protected $redirectAfterLogout = 'auth/login';

您可以使用任何网址更改auth/login.

you can change auth/login with any url.