如何读取 PHP sess_ 文件的值?
在 localhost(Debian Sid 机器)上,PHP 在 /var/lib/php5 中创建会话文件。例如,当我打开 sess_cd2ct9hud284gn01os13nk5mi7 时,我可以看到类似的内容:
Qms6wztHQ9u79B7jjiihLX0cKc_fXgwo0NeVE34jFhdE__1JDOliUDteHQVXgMAjcGZgJ1EkBft0IUsqBdWrck7s0Vjghsm3vk681u_GV8KRK-ExrAEbvbgXfl51Z83tyh5h2JtRy0qLZmhqwLtUFykm1XbdBBxx5xJpNpg4z_ccvOW2-k947-pn_L40lK_ZybK-9gTvD3giGy9pvtNHAoFuUE0KLH9kE87vTWKt4pbf-Upm3_VGLyu5yCqkWAxfJHILmlb1wAqfIssnS632YA..
如何使用此文件读取会话的实际值?这是一个 base64_hash 吗?
At localhost (Debian Sid machine), PHP creates session files in /var/lib/php5. When I open sess_cd2ct9hud284gn01os13nk5mi7, for example, i can see something like that:
Qms6wztHQ9u79B7jjiihLX0cKc_fXgwo0NeVE34jFhdE__1JDOliUDteHQVXgMAjcGZgJ1EkBft0IUsqBdWrck7s0Vjghsm3vk681u_GV8KRK-ExrAEbvbgXfl51Z83tyh5h2JtRy0qLZmhqwLtUFykm1XbdBBxx5xJpNpg4z_ccvOW2-k947-pn_L40lK_ZybK-9gTvD3giGy9pvtNHAoFuUE0KLH9kE87vTWKt4pbf-Upm3_VGLyu5yCqkWAxfJHILmlb1wAqfIssnS632YA..
How could I read the real value of the session using this file? Is this a base64_hash?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果您知道会话的“名称”或 ID,您可以在 PHP 中读取它。
您还可以尝试
session_decode()
< /a> 函数,它将序列化会话的内容加载到$_SESSION
超全局中。If you know the "name" or the id of the session you could read it within PHP.
You could also try the
session_decode()
function, which loads the contents of a serialized session into the$_SESSION
superglobal.sess_cd2ct9hud284gn01os13nk5mi7
cd2ct9hud284gn01os13nk5mi7
这是会话 ID,它在文件名中
sess_cd2ct9hud284gn01os13nk5mi7
cd2ct9hud284gn01os13nk5mi7
this is the session id, its in the name of the file