会话保存在哪里? [英] where does session save?

查看:43
本文介绍了会话保存在哪里?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道PHP会话数据保存在哪里;是在客户端浏览器中吗?还是在服务器上?

I would like to know where PHP session data is saved; is it in client browser? or on the server?

当我在浏览器设置中禁用 cookie 时,PHP 无法保存会话数据,但在 php.ini 中,我可以更改会话保存路径.

When I disable cookies in my browser setting, PHP can't save session data, but in php.ini, I can change the session save path.

会话数据是存储在服务器还是客户端浏览器上?

Is session data stored on the server or client browser?

推荐答案

你使用 $_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.

这篇关于会话保存在哪里?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆