session.php
driver
注释翻译:
/*
|--------------------------------------------------------------------------
| 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: "file", "cookie", "database", "apc",
| "memcached", "redis", "array"
|
*/
'driver' => env('SESSION_DRIVER', 'file'),
/*
|--------------------------------------------------------------------------
| 默认会话驱动程序
|--------------------------------------------------------------------------
|
| 此选项控制将在请求上使用的默认会话“驱动程序”。
| 默认情况下,我们将使用轻量级原生驱动程序,
| 但您可以指定更好的驱动程序。
|
| 支持: "file", "cookie", "database", "apc",
| "memcached", "redis", "array"
|
*/
'driver' => env('SESSION_DRIVER', 'file'),
个人理解:
session
的存储方式。和cache
差不多,多了一个cookie
选项。
lifetime
注释翻译
/*
|--------------------------------------------------------------------------
| Session Lifetime
|--------------------------------------------------------------------------
|
| Here you may specify the number of minutes that you wish the session
| to be allowed to remain idle before it expires. If you want them
| to immediately expire on the browser closing, set that option.
|
*/
'lifetime' => env('SESSION_LIFETIME', 120),
'expire_on_close' => false,
/*
|--------------------------------------------------------------------------
| 会话有效期
|--------------------------------------------------------------------------
|
| 在这里,您可以指定您希望会话在到期之前保持空闲状态的分钟数。
| 如果您希望它们在浏览器关闭时立即过期,请设置该选项。
|
|
*/
'lifetime' => env('SESSION_LIFETIME', 120),
'expire_on_close' => false,
个人理解:
lifetime
是session
的有效期,单位是分钟。expire_on_close
是设置关闭浏览器就过期。目前还没懂这两个怎么用。
encrypt
注释翻译
/*
|--------------------------------------------------------------------------
| Session Encryption
|--------------------------------------------------------------------------
|
| This option allows you to easily specify that all of your session data
| should be encrypted before it is stored. All encryption will be run
| automatically by Laravel and you can use the Session like normal.
|
*/
'encrypt' => false,
/*
|--------------------------------------------------------------------------
| 会话加密
|--------------------------------------------------------------------------
|
| 通过此选项,您可以轻松指定所有会话数据在存储之前都应进行加密。
| 所有加密都将由Laravel自动运行,您可以像正常一样使用会话。
|
|
*/
'encrypt' => false,
个人理解:加密
session
。我觉得可以加密一下。
/*
|--------------------------------------------------------------------------
| Session File Location
|--------------------------------------------------------------------------
|
| When using the native session driver, we need a location where session
| files may be stored. A default has been set for you but a different
| location may be specified. This is only needed for file sessions.
|
*/
'files' => storage_path('framework/sessions'),
/*
|--------------------------------------------------------------------------
| 会话文件位置
|--------------------------------------------------------------------------
|
| 使用本机会话驱动程序时,我们需要一个可以存储会话文件的位置。
| 已经为您设置了默认值,但是可以指定不同的位置。 这只是文件会话所必需的。
|
|
*/
'files' => storage_path('framework/sessions'),
个人理解:当使用
file
文件存储session
,设置文件所处的路径。
connection
注释翻译:
/*
|--------------------------------------------------------------------------
| Session Database Connection
|--------------------------------------------------------------------------
|
| When using the "database" or "redis" session drivers, you may specify a
| connection that should be used to manage these sessions. This should
| correspond to a connection in your database configuration options.
|
*/
'connection' => null,
/*
|--------------------------------------------------------------------------
| 会话数据库连接
|--------------------------------------------------------------------------
|
| 当使用“数据库”或“redis”会话驱动程序时,
| 您可以指定一个应该用于管理这些会话的连接。
| 这应该对应于数据库配置选项中的连接。
|
*/
'connection' => null,
个人理解:使用
database
或redis
时,表的连接方式。
table
注释翻译:
/*
|--------------------------------------------------------------------------
| Session Database Table
|--------------------------------------------------------------------------
|
| When using the "database" session driver, you may specify the table we
| should use to manage the sessions. Of course, a sensible default is
| provided for you; however, you are free to change this as needed.
|
*/
'table' => 'sessions',
/*
|--------------------------------------------------------------------------
| 会话数据库表
|--------------------------------------------------------------------------
|
| 当使用“数据库”会话驱动程序时,您可以指定我们应该用来管理会话的表格。
| 当然,给你一个合理的默认值, 不过,您可以根据需要随意更改。
|
|
*/
'table' => 'sessions',
个人理解:当使用
database
存储时,存储哪个表。
store
注释翻译:
/*
|--------------------------------------------------------------------------
| Session Cache Store
|--------------------------------------------------------------------------
|
| When using the "apc" or "memcached" session drivers, you may specify a
| cache store that should be used for these sessions. This value must
| correspond with one of the application's configured cache stores.
|
*/
'store' => null,
/*
|--------------------------------------------------------------------------
| 会话缓存存储
|--------------------------------------------------------------------------
|
| 当使用“apc”或“memcached”会话驱动程序时,
| 您可以指定应该用于这些会话的缓存存储。
| 该值必须与应用程序配置的缓存存储之一相对应。
|
*/
'store' => null,
个人理解:使用缓存来存储
session
。
lottery
注释翻译:
/*
|--------------------------------------------------------------------------
| Session Sweeping Lottery
|--------------------------------------------------------------------------
|
| Some session drivers must manually sweep their storage location to get
| rid of old sessions from storage. Here are the chances that it will
| happen on a given request. By default, the odds are 2 out of 100.
|
*/
'lottery' => [2, 100],
/*
|--------------------------------------------------------------------------
| 会话清除彩票
|--------------------------------------------------------------------------
|
| 某些会话驱动程序必须手动清除其存储位置才能摆脱存储中的旧会话。
| 这是一个给定的请求发生的机会。 默认情况下,赔率为2%。
|
|
*/
'lottery' => [2, 100],
个人理解:这个不知道。
cookie
注释翻译:
/*
|--------------------------------------------------------------------------
| Session Cookie Name
|--------------------------------------------------------------------------
|
| Here you may change the name of the cookie used to identify a session
| instance by ID. The name specified here will get used every time a
| new session cookie is created by the framework for every driver.
|
*/
'cookie' => env(
'SESSION_COOKIE',
str_slug(env('APP_NAME', 'laravel'), '_').'_session'
),
/*
|--------------------------------------------------------------------------
| 会话Cookie名称
|--------------------------------------------------------------------------
|
| 在这里,您可以更改用于通过ID标识会话实例的Cookie的名称。
| 每次为每个驱动程序创建一个新的会话cookie时,此处指定的名称将被使用。
|
|
*/
'cookie' => env(
'SESSION_COOKIE',
str_slug(env('APP_NAME', 'laravel'), '_').'_session'
),
个人理解:
path
注释翻译:
/*
|--------------------------------------------------------------------------
| Session Cookie Path
|--------------------------------------------------------------------------
|
| The session cookie path determines the path for which the cookie will
| be regarded as available. Typically, this will be the root path of
| your application but you are free to change this when necessary.
|
*/
'path' => '/',
/*
|--------------------------------------------------------------------------
| 会话Cookie路径
|--------------------------------------------------------------------------
|
| 会话cookie路径决定了cookie将被视为可用的路径。
| 通常,这将是您的应用程序的根路径,但您可以在必要时自由更改。
|
|
*/
'path' => '/',
个人理解:略。。。
domain
注释翻译:
/*
|--------------------------------------------------------------------------
| Session Cookie Domain
|--------------------------------------------------------------------------
|
| Here you may change the domain of the cookie used to identify a session
| in your application. This will determine which domains the cookie is
| available to in your application. A sensible default has been set.
|
*/
'domain' => env('SESSION_DOMAIN', null),
/*
|--------------------------------------------------------------------------
| Session Cookie Domain
|--------------------------------------------------------------------------
|
| 在这里,您可以更改用于在应用程序中识别会话的Cookie的域。
| 这将决定您的应用程序可以使用哪些域名。 一个明智的默认设置。
|
|
*/
'domain' => env('SESSION_DOMAIN', null),
个人理解:略。。。
secure
注释翻译:
/*
|--------------------------------------------------------------------------
| HTTPS Only Cookies
|--------------------------------------------------------------------------
|
| By setting this option to true, session cookies will only be sent back
| to the server if the browser has a HTTPS connection. This will keep
| the cookie from being sent to you if it can not be done securely.
|
*/
'secure' => env('SESSION_SECURE_COOKIE', false),
/*
|--------------------------------------------------------------------------
| HTTPS Only Cookies
|--------------------------------------------------------------------------
|
| 通过将此选项设置为true,如果浏览器具有HTTPS连接,
| 会话cookie将仅被发送回服务器。 如果不能安全地完成,
| cookie将不会被发送给您。
|
*/
'secure' => env('SESSION_SECURE_COOKIE', false),
个人理解:略。。。
http_only
注释翻译:
/*
|--------------------------------------------------------------------------
| HTTP Access Only
|--------------------------------------------------------------------------
|
| Setting this value to true will prevent JavaScript from accessing the
| value of the cookie and the cookie will only be accessible through
| the HTTP protocol. You are free to modify this option if needed.
|
*/
'http_only' => true,
/*
|--------------------------------------------------------------------------
| HTTP Access Only
|--------------------------------------------------------------------------
|
| 将此值设置为true将阻止JavaScript访问cookie的值,
| 并且Cookie将只能通过HTTP协议访问。
| 如果需要,您可以自由修改此选项。
|
*/
'http_only' => true,
个人理解:略。。。
same_site
注释翻译:
/*
|--------------------------------------------------------------------------
| Same-Site Cookies
|--------------------------------------------------------------------------
|
| This option determines how your cookies behave when cross-site requests
| take place, and can be used to mitigate CSRF attacks. By default, we
| do not enable this as other CSRF protection services are in place.
|
| Supported: "lax", "strict"
|
*/
'same_site' => null,
/*
|--------------------------------------------------------------------------
| Same-Site Cookies
|--------------------------------------------------------------------------
|
| 此选项决定了跨站点请求发生时Cookie的行为方式,
| 可用于缓解CSRF攻击。 默认情况下,我们不启用这个,
| 因为其他的CSRF保护服务已经到位。
|
| 支持: "lax", "strict"
|
*/
'same_site' => null,
个人理解:略。。。
session
的配置有些难理解。不知道这些是做什么的,日后再补上
网友评论