我将 loginuserid 存储在 session 中并在 logout 时销毁 session 。登录和注销工作正常,但我的问题是当用户注销并且我们按下后退按钮时,它仍然能够打开访问的页面,即使他实际上已注销。
当我们刷新页面时,用户进入登录页面。我希望用户即使按下后退按钮也不会进入访问的页面。请帮帮我。提前致谢 。
这实际上是因为浏览器缓存 - 您应该禁用它并使用CodeIgniters 缓存库 http://codeigniter.com/user_guide/libraries/caching.html如果需要任何缓存。
在需要用户登录的页面添加以下内容:
//Prevent browsers from using history to browse in the user system.
$this->CI->output->set_header("Cache-Control: no-store, no-cache, must-revalidate");
$this->CI->output->set_header("Expires: Sat, 26 Jul 1997 05:00:00 GMT");
$this->CI->output->set_header("Pragma: no-cache");
当在浏览器中按回键时,页面将刷新,
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)