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/
随机推荐
- 声明顺序 (Bootstrap 编码规范)
相关的属性声明应当归为一组,并按照下面的顺序排列: Positioning Box model Typographic Visual 由于定位(positioning)可以从正常的文档流中移除元素,并 ...
- iOS开发之UITextField
UITextField基本知识 UITextField展示的是一些可编辑的内容,并且与用户有一些交互.比如当你在虚拟键盘上按下return键时,一般会关联到键盘隐藏事件上.UITextField的一些 ...
- 基于MongoDB分布式存储进行MapReduce并行查询
中介绍了如何基于Mongodb进行关系型数据的分布式存储,有了存储就会牵扯到查询.虽然用普通的方式也可以进行查询,但今天要介绍的是如何使用MONGODB中提供的MapReduce功能进行查询. ...
- http://www.cnblogs.com/youfan/articles/3216816.html
我对 CodeFirst 的理解,与之对应的有 ModelFirst与 DatabaseFirst ,三者各有千秋,依项目实际情况自行选择. 1.开发过程中先行设计数据库并依此在项目中生成 *.dbm ...
- Oracle函数面试题
1.对字符串操作的函数? 答:ASCII() –函数返回字符表达式最左端字符的ASCII 码值 CHR() –函数用于将ASCII 码转换为字符 –如果没有输入0 ~ 255 之间的ASCII 码值C ...
- LeetCode题解——Longest Substring Without Repeating Characters
题目: 给定一个字符串,返回其中不包含重复字符的最长子串长度. 解法: 维持两个指针,第一个指向子串开始,第二个负责遍历,当遍历到的字符出现在子串内时,应计算当前子串长度,并更新最长值:然后第一个指针 ...
- 【译】 AWK教程指南 附录B-Actions
Actions 是由下列指令(statement)所组成: 表达式 ( 函数调用,赋值...) print 表达式列表 printf( 格式化字符串, 表达式列表) if( 表达式 ) 语句 [els ...
- 在生成 Visual c + + 2005年或从 DLL 文件中使用 CString 派生的类的 Visual c + +.net 应用程序时,您可能会收到 LNK2019 错误消息
http://support.microsoft.com/kb/309801
- HW6.30
import java.util.Scanner; public class Solution { public static void main(String[] args) { Scanner i ...
- POJ2389: 大数字乘法算法
2014-12-26 大数字乘法算法一般是采用模拟"小学生乘法演算过程”方法. 主要算法思想: 1. 乘数a第i)位与乘数b第j)位数字相乘,并将该乘积结果放到乘积结果数组product的第 ...