我试图让用户重定向到index.html页面,以防已经设置了$_SESSION‘’loggedin‘。由于某些原因,它不会重定向用户,尽管$_SESSION在回显时‘’loggedin‘返回值。
if(!empty($_SESSION['loggedin'])) { header('Location: index.html');};我在这里做错了什么?
发布于 2013-05-02 07:06:55
header('Location: index.html');设置http报头,该报头需要在发送任何内容之前设置,即在任何回应之前设置。另外,您应该在设置location标头后终止脚本。
https://stackoverflow.com/questions/16327810
复制相似问题