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/
随机推荐
- 【转】Bluetooth数据包捕获
原文网址:http://www.cnblogs.com/hzl6255/p/3887013.html 这里介绍一种在Android上捕获蓝牙数据包的方法 1. 前提 首先你要有一部Android手机 ...
- Hbase学习笔记(安装和基础知识及操作)
1.Hbase简介 1.面向列的分布式数据库 2. 以HDFS作为文件系统 3. 利用MapReduce处理Hbase中海量数据 4. ZookKeeper作为协调工具 5. sqoop提供Hbase ...
- Webdriver API (一)
(转载) 1.1 下载selenium2.0的包 官方download包地址:http://code.google.com/p/selenium/downloads/list 官方User Guid ...
- linux下Qt问题cannot find -lGL collect2: error: ld returned 1 exit status
fedora下解决 yum groupinstall "Development Tools" yum install mesa-libGL-devel ubuntu下解决 sudo ...
- bzoj 1176 Mokia(CDQ分治,BIT)
[题目链接] http://acm.hust.edu.cn/vjudge/problem/viewProblem.action?id=96974 [题意] 定义查询操作与修改操作:1 x y z 为 ...
- android NDK 实用学习(二)-java端对象成员赋值和获取对象成员值
1,关于java端类及接口定义请参考: android NDK 实用学习-获取java端类及其类变量 2,对传过来的参数进行赋值: 对bool类型成员进行赋值 env->SetBooleanF ...
- 单点登录sso规范
http://jasig.github.io/cas/development/protocol/CAS-Protocol-Specification.html
- HW6.4
import java.util.Scanner; public class Solution { public static void main(String[] args) { Scanner i ...
- iOS-关于微信支付
突然发现的一篇文章,这位博主介绍的还是挺详细的,给大家分享一下 不懂的也可以咨询我qq:564702640 1.申请接入 详见 微信支付申请接入 . 创建应用+审核通过,你将得到:APP_ID.APP ...
- Objective-C Runtime 运行时之六:拾遗
super 在Objective-C中,如果我们需要在类的方法中调用父类的方法时,通常都会用到super,如下所示: @interface MyViewController: UIViewContro ...