您当前的位置: 首页 > 慢生活 > 程序人生 网站首页程序人生
webman-session管理-删除所有session数据
发布时间:2022-01-27 17:08:27编辑:雪饮阅读()
用flush方法進行刪除,没有返回值,session对象销毁时session会自动从存储中删除。
實例:
public function index(Request $request)
{
$session = $request->session();
$session->set('name','kasumi');
$session->put(['gender'=>'famale','age'=>18,'spouse'=>'snowDrink','Congdi'=>'snowDrink']);
//刪除所有session
$flushRes=$request->session()->flush();
$sessionAll = $session->all();
$sessionFlushComplete=compact("flushRes","sessionAll");
return response(var_export($sessionFlushComplete,true));
}
實例被請求:
[root@localhost ~]# elinks http://127.0.0.1:8787/blog/index --dump
array ( 'flushRes' => NULL, 'sessionAll' => array ( ), )
关键字词:webman,session,删除,管理,所有,数据