您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

session.php 7.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218
  1. <?php
  2. use Illuminate\Support\Str;
  3. return [
  4. /*
  5. |--------------------------------------------------------------------------
  6. | Default Session Driver
  7. |--------------------------------------------------------------------------
  8. |
  9. | This option determines the default session driver that is utilized for
  10. | incoming requests. Laravel supports a variety of storage options to
  11. | persist session data. Database storage is a great default choice.
  12. |
  13. | Supported: "file", "cookie", "database", "apc",
  14. | "memcached", "redis", "dynamodb", "array"
  15. |
  16. */
  17. 'driver' => env('SESSION_DRIVER', 'database'),
  18. /*
  19. |--------------------------------------------------------------------------
  20. | Session Lifetime
  21. |--------------------------------------------------------------------------
  22. |
  23. | Here you may specify the number of minutes that you wish the session
  24. | to be allowed to remain idle before it expires. If you want them
  25. | to expire immediately when the browser is closed then you may
  26. | indicate that via the expire_on_close configuration option.
  27. |
  28. */
  29. 'lifetime' => env('SESSION_LIFETIME', 120),
  30. 'expire_on_close' => env('SESSION_EXPIRE_ON_CLOSE', false),
  31. /*
  32. |--------------------------------------------------------------------------
  33. | Session Encryption
  34. |--------------------------------------------------------------------------
  35. |
  36. | This option allows you to easily specify that all of your session data
  37. | should be encrypted before it's stored. All encryption is performed
  38. | automatically by Laravel and you may use the session like normal.
  39. |
  40. */
  41. 'encrypt' => env('SESSION_ENCRYPT', false),
  42. /*
  43. |--------------------------------------------------------------------------
  44. | Session File Location
  45. |--------------------------------------------------------------------------
  46. |
  47. | When utilizing the "file" session driver, the session files are placed
  48. | on disk. The default storage location is defined here; however, you
  49. | are free to provide another location where they should be stored.
  50. |
  51. */
  52. 'files' => storage_path('framework/sessions'),
  53. /*
  54. |--------------------------------------------------------------------------
  55. | Session Database Connection
  56. |--------------------------------------------------------------------------
  57. |
  58. | When using the "database" or "redis" session drivers, you may specify a
  59. | connection that should be used to manage these sessions. This should
  60. | correspond to a connection in your database configuration options.
  61. |
  62. */
  63. 'connection' => env('SESSION_CONNECTION'),
  64. /*
  65. |--------------------------------------------------------------------------
  66. | Session Database Table
  67. |--------------------------------------------------------------------------
  68. |
  69. | When using the "database" session driver, you may specify the table to
  70. | be used to store sessions. Of course, a sensible default is defined
  71. | for you; however, you're welcome to change this to another table.
  72. |
  73. */
  74. 'table' => env('SESSION_TABLE', 'sessions'),
  75. /*
  76. |--------------------------------------------------------------------------
  77. | Session Cache Store
  78. |--------------------------------------------------------------------------
  79. |
  80. | When using one of the framework's cache driven session backends, you may
  81. | define the cache store which should be used to store the session data
  82. | between requests. This must match one of your defined cache stores.
  83. |
  84. | Affects: "apc", "dynamodb", "memcached", "redis"
  85. |
  86. */
  87. 'store' => env('SESSION_STORE'),
  88. /*
  89. |--------------------------------------------------------------------------
  90. | Session Sweeping Lottery
  91. |--------------------------------------------------------------------------
  92. |
  93. | Some session drivers must manually sweep their storage location to get
  94. | rid of old sessions from storage. Here are the chances that it will
  95. | happen on a given request. By default, the odds are 2 out of 100.
  96. |
  97. */
  98. 'lottery' => [2, 100],
  99. /*
  100. |--------------------------------------------------------------------------
  101. | Session Cookie Name
  102. |--------------------------------------------------------------------------
  103. |
  104. | Here you may change the name of the session cookie that is created by
  105. | the framework. Typically, you should not need to change this value
  106. | since doing so does not grant a meaningful security improvement.
  107. |
  108. |
  109. */
  110. 'cookie' => env(
  111. 'SESSION_COOKIE',
  112. Str::slug(env('APP_NAME', 'laravel'), '_') . '_session'
  113. ),
  114. /*
  115. |--------------------------------------------------------------------------
  116. | Session Cookie Path
  117. |--------------------------------------------------------------------------
  118. |
  119. | The session cookie path determines the path for which the cookie will
  120. | be regarded as available. Typically, this will be the root path of
  121. | your application, but you're free to change this when necessary.
  122. |
  123. */
  124. 'path' => env('SESSION_PATH', '/'),
  125. /*
  126. |--------------------------------------------------------------------------
  127. | Session Cookie Domain
  128. |--------------------------------------------------------------------------
  129. |
  130. | This value determines the domain and subdomains the session cookie is
  131. | available to. By default, the cookie will be available to the root
  132. | domain and all subdomains. Typically, this shouldn't be changed.
  133. |
  134. */
  135. 'domain' => env('SESSION_DOMAIN'),
  136. /*
  137. |--------------------------------------------------------------------------
  138. | HTTPS Only Cookies
  139. |--------------------------------------------------------------------------
  140. |
  141. | By setting this option to true, session cookies will only be sent back
  142. | to the server if the browser has a HTTPS connection. This will keep
  143. | the cookie from being sent to you when it can't be done securely.
  144. |
  145. */
  146. 'secure' => env('SESSION_SECURE_COOKIE'),
  147. /*
  148. |--------------------------------------------------------------------------
  149. | HTTP Access Only
  150. |--------------------------------------------------------------------------
  151. |
  152. | Setting this value to true will prevent JavaScript from accessing the
  153. | value of the cookie and the cookie will only be accessible through
  154. | the HTTP protocol. It's unlikely you should disable this option.
  155. |
  156. */
  157. 'http_only' => env('SESSION_HTTP_ONLY', true),
  158. /*
  159. |--------------------------------------------------------------------------
  160. | Same-Site Cookies
  161. |--------------------------------------------------------------------------
  162. |
  163. | This option determines how your cookies behave when cross-site requests
  164. | take place, and can be used to mitigate CSRF attacks. By default, we
  165. | will set this value to "lax" to permit secure cross-site requests.
  166. |
  167. | See: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Set-Cookie#samesitesamesite-value
  168. |
  169. | Supported: "lax", "strict", "none", null
  170. |
  171. */
  172. 'same_site' => env('SESSION_SAME_SITE', 'lax'),
  173. /*
  174. |--------------------------------------------------------------------------
  175. | Partitioned Cookies
  176. |--------------------------------------------------------------------------
  177. |
  178. | Setting this value to true will tie the cookie to the top-level site for
  179. | a cross-site context. Partitioned cookies are accepted by the browser
  180. | when flagged "secure" and the Same-Site attribute is set to "none".
  181. |
  182. */
  183. 'partitioned' => env('SESSION_PARTITIONED_COOKIE', false),
  184. ];