更新时间:2023-11-28 09:36:46
会话存储在服务器上,这意味着客户端无法访问您存储的有关它们的信息.会话数据存储在您的服务器上,不需要与每个页面一起完整传输;客户端只需要发送一个 ID,数据就会从服务器加载.
Sessions are stored on the server, which means clients do not have access to the information you store about them. Session data, being stored on your server, does not need to be transmitted in full with each page; clients just need to send an ID and the data is loaded from the server.
另一方面,cookie 存储在客户端.它们可以长时间耐用,并且当您拥有一组 Web 服务器时,可以让您更顺畅地工作.但是,与会话不同的是,存储在 cookie 中的数据会随每个页面请求完整传输.
On the other hand, cookies are stored on the client. They can be made durable for a long time and would allow you to work more smoothly when you have a cluster of web servers. However, unlike sessions, data stored in cookies is transmitted in full with each page request.
避免在 cookie 中存储数据
Avoid storing data in cookies
您可以在会话数据中存储什么取决于您拥有的数据量和用户数量.no_of_users
* size_of_session_data
必须小于服务器上的可用内存.
What you can store in session data depends on the amount of data and number of users you have. no_of_users
* size_of_session_data
must be less than the free memory available on your server.