当浏览器关闭时,会话中保存的数据会丢失吗? [英] when browser is closed , does saved data in session lost?

查看:69
本文介绍了当浏览器关闭时,会话中保存的数据会丢失吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 php 中,在创建会话并向此会话添加数据后,我们关闭浏览器.那么,当我打开浏览器时,我可以从会话中获取这些添加的数据吗?

In php , after the session is created and added data to this session , then we close the browser. then, when I open browser , can I get this added data from session ?

推荐答案

如果您希望用户关闭浏览器后会话仍然存在,请查看:

If you want to have a user's session persist after they close the browser, please review:

session.cookie_lifetime 指定发送到浏览器的 cookie 的生命周期(以秒为单位).值 0 表示直到浏览器关闭".默认为 0.另见 session_get_cookie_params() 和 session_set_cookie_params().

session.cookie_lifetime specifies the lifetime of the cookie in seconds which is sent to the browser. The value 0 means "until the browser is closed." Defaults to 0. See also session_get_cookie_params() and session_set_cookie_params().

显示在 关于会话的运行时配置页面.通过这种方式,会话 cookie 不会只持续到浏览器关闭,而是可以在他们重新打开浏览器并返回到您的网站时继续存在.

Shown at the Runtime Configuration page regarding sessions. This way, rather than the session cookie only lasting until the browser is closed, it can persist and continue on when they re-open the browser and go back to your site.

这篇关于当浏览器关闭时,会话中保存的数据会丢失吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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