Laravel会话驱动程序?

Mik*_*ler 5 laravel laravel-4

任何人都可以向我解释会话驱动程序吗?对"laravel会话驱动程序"的搜索没有透露出不同类型的内容.我问,因为以下教程建议使用REST API的数组驱动程序,但我不知道为什么.教程:https://speakerdeck.com/akuzemchak/simple-api-development-with-laravel? slide =62

这是app/config/session.php的相关部分

/*
|--------------------------------------------------------------------------
| Default Session Driver
|--------------------------------------------------------------------------
|
| This option controls the default session "driver" that will be used on
| requests. By default, we will use the lightweight native driver but
| you may specify any of the other wonderful drivers provided here.
|
| Supported: "native", "cookie", "database", "apc",
|            "memcached", "redis", "array"
|
*/

'driver' => 'native',
Run Code Online (Sandbox Code Playgroud)

rad*_*men 14

这很容易.驱动程序定义会话数据的存储位置.

  • native - 会话将由内部PHP rutines处理
  • cookie - 会话将存储在cookie中
  • database- 会话将存储在数据库中(默认情况下在表中sessions)
  • memcached/ redis- 使用其中一个守护进程作为会话存储
  • array- 会话将存储在一个普通数组中(由MockArraySessionStorage处理)

array 驱动程序意味着会话只是按请求(在PHP运行时存储),然后消失:)

  • laravel 5+有'file'而不是'native'. (3认同)
  • laravel 5+已经删除了`native` (2认同)