本文介绍了浏览器关闭时会话销毁的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我多次听说当我们的浏览器关闭时会话会被破坏.
I have heard many times that a session get destroy as our browser close.
然后我如何在关闭并重新打开浏览器后保持登录状态.
Then how I keep logged in after closing and reopening my browser.
请帮忙
推荐答案
您保持登录状态,因为即使关闭浏览器,您的会话也不会被破坏.在浏览器关闭时销毁会话是默认行为,但这并不意味着它是唯一的行为.您可以延长会话的到期时间.
You keep login because your sessions are not destroyed even when the browser is closed. Sessions destroying on the closing of the browser is default behaviour but but this does not mean its the only behaviour. You can extend the expiry time of session.
This behaviour can be changed in the php.ini file by altering the line:
无限期地保持会话活动
session.cookie_lifetime = 0
所以只需检查您何时设置了会话的到期时间.虽然使用 cookie 将是一个不错的选择
注意:- 请记住在进行此更改后重新启动您的网络服务器.
Note:- Remember to restart your web server after making this change.
这篇关于浏览器关闭时会话销毁的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!