[英]How does an HTTP session exactly work and in what cases does it expire (in Laravel)?
I'm creating a Laravel application and I'm trying to grasp the concept of the HTTP session .我正在创建一个 Laravel 应用程序,并试图掌握HTTP session的概念。 I noticed that I don't really understand it on a fundamental level (eg what exactly happens ).
我注意到我在基本层面上并没有真正理解它(例如究竟发生了什么)。
On the internet there isn't much information available besides some basic stuff (getting and retrieving data, plus a few other common things).在互联网上,除了一些基本的东西(获取和检索数据,以及一些其他常见的东西)之外,没有太多可用的信息。
I want to better understand it, so it'd be extremely helpful is someone could clarify the following things for me:我想更好地理解它,因此如果有人可以为我澄清以下事项,那将非常有帮助:
file
vs cookie
? file
vs cookie
时会发生什么? Many thanks in advance!提前谢谢了!
As you can see, session
is dependent on the driver
you choose, and at the same time you can select the timeout as well in config\\session.php
.如您所见,
session
取决于您选择的driver
,同时您也可以在config\\session.php
选择超时。
In case of Cookie
, the session will expire in two cases:在
Cookie
情况下,会话将在两种情况下过期:
(current_time - cookie_creation_time) > session_timeout
set in the session.php
.(current_time - cookie_creation_time) > session_timeout
在session.php
设置。 In all drivers, one thing is common: whenever you access the website, and a request is made to the server, it will add the last access time and calculate the session timeout from there.在所有驱动程序中,有一件事是共同的:每当您访问网站,并向服务器发出请求时,它会添加上次访问时间并从那里计算会话超时。
When the user navigates from the browser and the cookie is still there and it hasn't expired, the user will be identified and session will remain the same.当用户从浏览器导航并且 cookie 仍然存在并且它没有过期时,用户将被识别并且会话将保持不变。
I hope it's clearer... If not, let me know.我希望它更清楚......如果没有,请告诉我。 I will share some examples.
我将分享一些例子。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.