即使在浏览器关闭后也可以保持会话吗? [英] Is possible to keep session even after the browser is closed?

查看:27
本文介绍了即使在浏览器关闭后也可以保持会话吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

谁能告诉我如何维护会话(在 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.

这篇关于即使在浏览器关闭后也可以保持会话吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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