会话保存在哪里?

编程入门 行业动态 更新时间:2024-10-09 16:32:04
本文介绍了会话保存在哪里?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我想知道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.

更多推荐

会话保存在哪里?

本文发布于:2023-11-26 07:48:25,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1633249.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!