Session Store
Session Store
Configuration
Since HTTP driven applications are stateless, sessions provide a way to store information about the user across requests. Nova ships with a variety of session back-ends available for use through a clean, unified API.
The session configuration is stored in app/Config/Session.php. Be sure to review the well documented options available to you in this file. By default, Nova is configured to use the file session driver, which will work well for the majority of applications.
Reserved Keys
The Nova framework uses the flash session key internally, so you should not add an item to the session by that name.
Session Usage
Storing An Item In The Session
Session::put('key', 'value');
Push A Value Onto An Array Session Value
Session::push('user.teams', 'developers');
Retrieving An Item From The Session
$value = Session::get('key');
Retrieving An Item Or Returning A Default Value
$value = Session::get('key', 'default');
$value = Session::get('key', function() { return 'default'; });
Retrieving An Item And Forgetting It
$value = Session::remove('key', 'default');
Retrieving All Data From The Session
$data = Session::all();
Determining If An Item Exists In The Session
if (Session::has('users'))
{
//
}
Removing An Item From The Session
Session::forget('key');
Removing All Items From The Session
Session::flush();
Regenerating The Session ID
Session::regenerate();
Flash Data
Sometimes you may wish to store items in the session only for the next request. You may do so using the Session::flash method:
Session::flash('key', 'value');
Reflashing The Current Flash Data For Another Request
Session::reflash();
Reflashing Only A Subset Of Flash Data
Session::keep(array('username', 'email'));
Session Drivers
The session "driver" defines where session data will be stored for each request. Nova ships with several great drivers out of the box:
- file - sessions will be stored in app/Storage/Sessions.
- database - sessions will be stored in a database used by your application.
Session Store的更多相关文章
- 在Apache Tomcat 7设置redis作为session store
在Apache Tomcat 7设置redis作为session store //输出tomcat控制台日志 root@ubuntu:~# cd /usr/tomcat/apache-tomcat- ...
- MongoDB实践-自定义ASP.NET Session Store
Session由来 由于HTTP协议是无状态的,客户端与服务器端进行“请求-响应”操作后,建立的连接就释放了,服务器端根本不知道刚才是哪个客户端访问的.但是有些场景是需要知道客户端的状态的,最典型的就 ...
- No Spring Session store is configured: set the 'spring.session.store-type'
发现session store type使用来存放session的存储方式,目前Spring boot中只支持Redis方式. 由于本应用暂无需将session放入redis的需求,故这里就可以将se ...
- Spring.之.报错:Caused by: java.lang.IllegalArgumentException: No Spring Session store is configured: set the 'spring.session.store-type' property
Spring.之.报错 No Spring Session store is configured springboot在启动的时候报如下错误: Error starting ApplicationC ...
- laravel5.6中Session store not set on request问题如何解决
先找到文件app下的Kernel.php文件,在文件中加入下列代码 protected $middleware = [ \Illuminate\Foundation\Http\Middleware\C ...
- session一直报错Session store not set on request
Route::group(['middleware' => ['web']], function () { //});仍然报错,看了 session是使用默认file,没问题:app/stora ...
- php about session store db or cache
PHP关于Session的配置: 在php.ini中配置为:session.name = PHPSESSID 在请求开始的时候,会话名称会被重置并存储到session.name配置项. 所以要想在不改 ...
- spring boot项目启动报(No session repository could be auto-configured, check your configuration (session store type is 'null'))
找到项目的application配置文件,增加 spring.session.store-type=none,重新启动问题解决 注:因为项目未使用redis管理session,可以如上设置,如果想使用 ...
- Using Redis as Django's session store and cache backend
http://michal.karzynski.pl/blog/2013/07/14/using-redis-as-django-session-store-and-cache-backend/
随机推荐
- android ListView注意事项
所有问题,都是自己遇到过的. 但内容,有一半是自己写的,也有一半是复制过来. 所以,写成原创还请原谅 1. ListView添加标题后(addHeader())后,使用listView.getAdap ...
- 将android中的sample例子到eclipse中
SDK中带有很多的例子,那么我们怎么样导入到eclipse中呢?方法很简单,如下: 1. 新建android工程,选择Create project from existing sample, 2. 选 ...
- POJ 1655-Balancing Act(树形dp)
题意: 求n个节点的树中哪个节点删除以后得到的最大连通分量最小. 分析:同上题 #include <map> #include <set> #include <list& ...
- 【idea】移动下载站
硬件: 1.Mac或 Linux台 2.300M 无线TP-LINK TL-WR802N AP无密码,与 Mac 同一个网段,Mac开 rails 应用 扫一扫页面,手机下载.OK Mac 搭建ROR ...
- js基础第3天
仿淘宝搜索框案例(有价值) 判断用户输入事件 正常浏览器:oninput(判断用户输入) ie678浏览器兼容:onpropertychange(因为兼容性问题, ie浏览器678是需要使用这个来判断 ...
- Python 同时for遍历多个列表
a = range(3) b = range(3) [ (x, y) for x, y in zip(a, b) ] 结果: [ (0,0), (1,1), (2,2) ] 当然,如上可以推广到多个列 ...
- CentOS 6.5 安装配置VSFTP
1.下载安装VSFTP 首先查看当前系统是否已经安装VSFTP,若未安装则使用yum安装. chkconfig --list | grep vsftpd #查看是否安装 yum install vsf ...
- HDU-4647 Another Graph Game 贪心,博弈
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4647 注意这题两人的决策是想要使得自己的分数与对方的差值最大.. 注意到数据范围,显然是贪心之类的,如 ...
- SGU131 - Hardwood floor(状态压缩DP)
题目大意 给定一个N*M大小的矩形,要求你用1*2和2*2(缺个角)的砖块把矩形铺满(不能重叠),问总共有多少种铺法? 题解 受POJ2411的影响,怎么都没想到3,4,5,6这几种情况该怎么放置,看 ...
- MariaDB-5.5.32源码编译安装
MariaDB数据库管理系统是MySQL的一个分支,主要由开源社区在维护,采用GPL授权许可.开发这个分支的原因之一是:Oracle公司收购了MySQL后,有将MySQL闭源的潜在风险,因此社区采用分 ...