public function session1(Request $request){
//1.HTTP request session();
//$request->session()->put('key1','value1');
//$re = $request->session()->get('key1');
//2.session()
//session()->put('key2','value2');
//$re = session()->get('key2');
//3.Session
//存数据
//Session::put('key3','value3');
//获取session值
// $re = Session::get('key3');
//session不存在取默认值
//$re = Session::get('key4','default');
//session中存数组
//Session::put(['key'=>'value4']);
//$re = Session::get('key');
//把数据放在session的数组中
//Session::push('student','sjh');
//Session::push('student','wbq');
//var_dump(Session::get('student','default'));
//获取所有session
//$res = Session::all();
//判断session中是否存在某个key
//if(Session::has('key1')){
// $res = Session::all();
// var_dump($res);
//}else{
// echo 'Where is your BOSS?!';
//}
//删除key1的session
//Session::forget('key1');
//$res = Session::all();
//删除所有session
//Session::flush();
//session暂存
//Session::flash('val1','val111');
//echo Session::get('val1');
}
laravel学习笔记之session控制
最新推荐文章于 2023-04-14 13:14:36 发布