[英]PHP: session seems to be lost after header redirect only on IE
I can't find a good answer for this anywhere. 我在任何地方都找不到合适的答案。 I have a login page, and after a good login it redirects to main page. 我有一个登录页面,登录成功后,它会重定向到主页。 In FF, and chrome - works perfect. 在FF和chrome中,效果完美。 On IE it doesn't work. 在IE上不起作用。 I keep losing the session when I get to the main page. 进入主页后,我一直在丢失会话。
I have checked the following: - session_start at top - no blanks or anything befoer header redirect - one line before the redirect, IE knows the session user id, but after the redirect, just one line after the session start, it loses the session user id - I've checked it also on other computer - same results 我已经检查了以下内容:-会话开始在顶部-标题之前没有空白或任何内容-重定向前一行,IE知道会话用户ID,但是重定向后,会话开始后仅一行,它将丢失会话用户id-我也在其他计算机上检查过-同样的结果
What is wrong with IE? IE有什么问题? or what could be wrong with my script ? 还是我的脚本可能出什么问题? Thanks 谢谢
error_reporting
to -1
; 将PHP的error_reporting
设置为-1
; reproduce error; 重现错误; check logs 检查日志 $_SESSION
relies on either a cookie or URL-based session identifier. 检查IE的隐私设置- $_SESSION
依赖于cookie或基于URL的会话标识符。 It seems as though it's having trouble saving the cookie 似乎无法保存Cookie [Edit] [编辑]
session_start()
twice ;) 确保您没有两次调用session_start()
;) Ok, 好,
Problem solved. 问题解决了。 I can't find the logic behind this solution, but although I had session_start() at the top of the page, I added another session_start() just before writing the session vars. 我找不到此解决方案背后的逻辑,但是尽管我在页面顶部有session_start(),但在编写会话变量之前我又添加了另一个session_start()。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.