且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

会话保存在哪里?

更新时间:2022-06-15 23:58:12

你使用 $_SESSION 读写的 session data 存储在服务器端,通常在临时目录中的文本文件.它们无法从外部访问.

The session data that you read and write using $_SESSION is stored on server side, usually in text files in a temporary directory. They can not be accessed from outside.

将会话连接到客户端浏览器的是会话 ID,它通常存储在 cookie 中(有关该规则的例外情况,请参阅注释).此 ID 是并且应该是存储在客户端的有关您的会话的唯一内容.

The thing connecting a session to a client browser is the session ID, which is usually stored in a cookie (see the comments for exceptions to that rule). This ID is, and should be, the only thing about your session that is stored on client side.

如果您在浏览器中删除 cookie,则与该会话的连接将丢失,即使服务器上的文件继续存在一段时间.

If you delete the cookie in the browser, the connection to that session is lost, even if the file on the server continues to exist for some time.

session.save_path 变量影响在服务器上存储会话数据的位置.如果您不是服务器的管理员,通常不需要更改.

The session.save_path variable influences the location on the server where the session data is stored. If you are not the server's administrator, it is usually not necessary to change it.