注销时如何更改重定向URL? [英] How to change the redirect url when logging out?

查看:103
本文介绍了注销时如何更改重定向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.

这篇关于注销时如何更改重定向URL?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆