session.php 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | LARAVEL8.0 框架 [ LARAVEL ][ RXThinkCMF ]
  4. // +----------------------------------------------------------------------
  5. // | 版权所有 2017~2021 LARAVEL研发中心
  6. // +----------------------------------------------------------------------
  7. // | 官方网站: http://www.laravel.cn
  8. // +----------------------------------------------------------------------
  9. // | Author: laravel开发员 <laravel.qq.com>
  10. // +----------------------------------------------------------------------
  11. use Illuminate\Support\Str;
  12. return [
  13. /*
  14. |--------------------------------------------------------------------------
  15. | Default Session Driver
  16. |--------------------------------------------------------------------------
  17. |
  18. | This option controls the default session "driver" that will be used on
  19. | requests. By default, we will use the lightweight native driver but
  20. | you may specify any of the other wonderful drivers provided here.
  21. |
  22. | Supported: "file", "cookie", "database", "apc",
  23. | "memcached", "redis", "dynamodb", "array"
  24. |
  25. */
  26. 'driver' => env('SESSION_DRIVER', 'file'),
  27. /*
  28. |--------------------------------------------------------------------------
  29. | Session Lifetime
  30. |--------------------------------------------------------------------------
  31. |
  32. | Here you may specify the number of minutes that you wish the session
  33. | to be allowed to remain idle before it expires. If you want them
  34. | to immediately expire on the browser closing, set that option.
  35. |
  36. */
  37. 'lifetime' => env('SESSION_LIFETIME', 120),
  38. 'expire_on_close' => false,
  39. /*
  40. |--------------------------------------------------------------------------
  41. | Session Encryption
  42. |--------------------------------------------------------------------------
  43. |
  44. | This option allows you to easily specify that all of your session data
  45. | should be encrypted before it is stored. All encryption will be run
  46. | automatically by Laravel and you can use the Session like normal.
  47. |
  48. */
  49. 'encrypt' => false,
  50. /*
  51. |--------------------------------------------------------------------------
  52. | Session File Location
  53. |--------------------------------------------------------------------------
  54. |
  55. | When using the native session driver, we need a location where session
  56. | files may be stored. A default has been set for you but a different
  57. | location may be specified. This is only needed for file sessions.
  58. |
  59. */
  60. 'files' => storage_path('framework/sessions'),
  61. /*
  62. |--------------------------------------------------------------------------
  63. | Session Database Connection
  64. |--------------------------------------------------------------------------
  65. |
  66. | When using the "database" or "redis" session drivers, you may specify a
  67. | connection that should be used to manage these sessions. This should
  68. | correspond to a connection in your database configuration options.
  69. |
  70. */
  71. 'connection' => env('SESSION_CONNECTION', null),
  72. /*
  73. |--------------------------------------------------------------------------
  74. | Session Database Table
  75. |--------------------------------------------------------------------------
  76. |
  77. | When using the "database" session driver, you may specify the table we
  78. | should use to manage the sessions. Of course, a sensible default is
  79. | provided for you; however, you are free to change this as needed.
  80. |
  81. */
  82. 'table' => 'sessions',
  83. /*
  84. |--------------------------------------------------------------------------
  85. | Session Cache Store
  86. |--------------------------------------------------------------------------
  87. |
  88. | While using one of the framework's cache driven session backends you may
  89. | list a cache store that should be used for these sessions. This value
  90. | must match with one of the application's configured cache "stores".
  91. |
  92. | Affects: "apc", "dynamodb", "memcached", "redis"
  93. |
  94. */
  95. 'store' => env('SESSION_STORE', null),
  96. /*
  97. |--------------------------------------------------------------------------
  98. | Session Sweeping Lottery
  99. |--------------------------------------------------------------------------
  100. |
  101. | Some session drivers must manually sweep their storage location to get
  102. | rid of old sessions from storage. Here are the chances that it will
  103. | happen on a given request. By default, the odds are 2 out of 100.
  104. |
  105. */
  106. 'lottery' => [2, 100],
  107. /*
  108. |--------------------------------------------------------------------------
  109. | Session Cookie Name
  110. |--------------------------------------------------------------------------
  111. |
  112. | Here you may change the name of the cookie used to identify a session
  113. | instance by ID. The name specified here will get used every time a
  114. | new session cookie is created by the framework for every driver.
  115. |
  116. */
  117. 'cookie' => env(
  118. 'SESSION_COOKIE',
  119. Str::slug(env('APP_NAME', 'laravel'), '_').'_session'
  120. ),
  121. /*
  122. |--------------------------------------------------------------------------
  123. | Session Cookie Path
  124. |--------------------------------------------------------------------------
  125. |
  126. | The session cookie path determines the path for which the cookie will
  127. | be regarded as available. Typically, this will be the root path of
  128. | your application but you are free to change this when necessary.
  129. |
  130. */
  131. 'path' => '/',
  132. /*
  133. |--------------------------------------------------------------------------
  134. | Session Cookie Domain
  135. |--------------------------------------------------------------------------
  136. |
  137. | Here you may change the domain of the cookie used to identify a session
  138. | in your application. This will determine which domains the cookie is
  139. | available to in your application. A sensible default has been set.
  140. |
  141. */
  142. 'domain' => env('SESSION_DOMAIN', null),
  143. /*
  144. |--------------------------------------------------------------------------
  145. | HTTPS Only Cookies
  146. |--------------------------------------------------------------------------
  147. |
  148. | By setting this option to true, session cookies will only be sent back
  149. | to the server if the browser has a HTTPS connection. This will keep
  150. | the cookie from being sent to you if it can not be done securely.
  151. |
  152. */
  153. 'secure' => env('SESSION_SECURE_COOKIE'),
  154. /*
  155. |--------------------------------------------------------------------------
  156. | HTTP Access Only
  157. |--------------------------------------------------------------------------
  158. |
  159. | Setting this value to true will prevent JavaScript from accessing the
  160. | value of the cookie and the cookie will only be accessible through
  161. | the HTTP protocol. You are free to modify this option if needed.
  162. |
  163. */
  164. 'http_only' => true,
  165. /*
  166. |--------------------------------------------------------------------------
  167. | Same-Site Cookies
  168. |--------------------------------------------------------------------------
  169. |
  170. | This option determines how your cookies behave when cross-site requests
  171. | take place, and can be used to mitigate CSRF attacks. By default, we
  172. | will set this value to "lax" since this is a secure default value.
  173. |
  174. | Supported: "lax", "strict", "none", null
  175. |
  176. */
  177. 'same_site' => 'lax',
  178. ];