PHP,会话问题 [英] PHP, session problems
问题描述
我的数据库更改了会话变量后,会话变量出现问题,当我按下后退按钮时它不会更新新的会话变量,但在数据库上,它已经更新但不在网页上,我必须重新登录才能看到新变量.
Im having problems with session variable after my database have changed the session variable, it doesnt update the new session variable when i press the back button but on database, it already updated but not on the webpage, i have to relogin to see the new variable.
以及如何使用 session_regenerate_id?
and how do i use session_regenerate_id?
推荐答案
当用户按下后退按钮时,他们的浏览器通常会显示一个缓存页面,而不是重新请求该页面,因此这很可能是您的问题所在来自.
When a user presses the back button, their browser generally shows a cached page, rather than re-requesting the page, so that's most likely where your issue is coming from.
您通过调用 session_regenerate_id 来使用它...并且用户将获得一个新的会话 ID,并且他们的会话将转移到该 ID,如果您将 True
作为参数传递,会话也将被清除.它通常用于防止会话固定攻击
You use session_regenerate_id by calling it... and the user will be given a new session ID and their session will be transfered over to that ID, if you pass True
as a parameter, the session will be cleared, too. It's generally used to prevent session fixation attacks
这篇关于PHP,会话问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!