【问题标题】:Auth::logout in laravel 5.2 is not workinglaravel 5.2 中的 Auth::logout 不起作用
【发布时间】:2016-05-16 14:14:49
【问题描述】:

我的问题与here提出的问题非常相似

我正在使用 Laravel 5.2

我的路线:列表

我的退出链接

<a href="logout" class="btn1 btn-1 btn1-1b">Logout</a>

注销链接在 header.blade.php 文件中。文件的位置是

Views->profile->header.blade.php

我的路由.php

Route::get('profile/logout', 'Auth\AuthController@getLogout');

此路由在中间件之外

AuthController.php

public function __construct()
{
     $this->middleware('guest', ['except' => ['logout', 'getLogout']]);
}

当注销按钮根据会话要求单击其重定向时,并没有结束,因为如果我通过 URL 访问,我仍然处于登录状态

【问题讨论】:

  • 如果通过 url 访问什么仍然登录?
  • www.mydomainname.com/profile/create

标签: session authentication controller laravel-5.2


【解决方案1】:

感谢您的所有回答, 我通过使用 laravel Blade 组织布局来解决这个问题。

在我的视图下有子文件夹之前,

所以我设法拉出所有子文件夹对齐它们,如下图所示,

-- 浏览量

--- 布局

------- default.blade.php

------- sidebar.blade.php

--- 简介

------- home.blade.php

------- about.blade.php

------- projects.blade.php

-------contact.blade.php

------- create.blade.php

---包括

------- head.blade.php

------- header.blade.php

------- footer.blade.php

------- sidebar.blade.php

【讨论】:

    【解决方案2】:

    从 Laravel 5.2 开始,你应该添加 web 中间件来使用 session。尝试在构造函数或路由中添加 Web 中间件。

    【讨论】:

      猜你喜欢
      • 2016-04-01
      • 2017-01-06
      • 2017-01-06
      • 2016-04-07
      • 2014-10-03
      • 2016-08-11
      • 1970-01-01
      • 1970-01-01
      • 2018-03-28
      相关资源
      最近更新 更多