如何在Laravel 5中删除会话 [英] how to remove sessions in Laravel 5
本文介绍了如何在Laravel 5中删除会话的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试删除基本会话,但并没有删除.这是代码
I am trying to remove a basic session but it's not removing. Here's the code
welcome.blade.php
@if(Session::has('key'))
{{ Session::get('key')}}
<a href="logout">Sign Out</a>
@else
please signin
@endif
</div>
我不知道如何删除会话.这是我用过的,但是不起作用route.php
I don't know how to remove session. Here's the one I used but it's not working route.php
Route::get('/logout', function() {
$vv = Session::forget('key');
if($vv)
{
return "signout";
}
});
推荐答案
您应使用此方法
Route::get('/logout', function() {
Session::forget('key');
if(!Session::has('key'))
{
return "signout";
}
});
这篇关于如何在Laravel 5中删除会话的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文