即使在浏览器关闭后也可以保持会话吗?

编程入门 行业动态 更新时间:2024-10-21 18:57:38
本文介绍了即使在浏览器关闭后也可以保持会话吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

谁能告诉我如何维护会话(在 PHP 中),以便即使在浏览器重新启动后,会话所包含的内容也能被保留和访问.

Could anyone tell how to maintain a session (in PHP) so that the session contains are preserved and are accessible even after the browser is restarted.

通常会话会随着浏览器的关闭而过期,但我希望会话不会被关闭,以便下次使用浏览器时可以访问会话数据.

In general a session expires with the closing of a browser, but I want the session NOT TO BE CLOSED so that the session data's can be accessed the next time the browser is used.

推荐答案

使用 session_set_cookie_parameters() 在开始会话之前给会话 cookie 一个非零的生命周期,或者设置 session.cookie_lifetime 为非零.

Use session_set_cookie_parameters() to give the session cookie a non-zero lifetime before starting the session, or set session.cookie_lifetime to non-zero.

更多推荐

即使在浏览器关闭后也可以保持会话吗?

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

发布评论

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

>www.elefans.com

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