开发者

PHP Session help

开发者 https://www.devze.com 2022-12-10 03:56 出处:网络
HI , When I try to logout using the following code in IE it for some reasons just loops and loops and loops and wont stop.

HI ,

When I try to logout using the following code in IE it for some reasons just loops and loops and loops and wont stop.

<?php $_SESSION = array(); session_destroy(); ?> 

<meta http-equiv="refresh" content="0;index.php"> 

Still getting s开发者_StackOverflow社区ome error's with this.

It seems that in IE it keep refreshing every second if I change 0 to 20 its every 20 seconds but the thing is it does not get to index.php it says on the current screen which is logout.php


Noticed you don't seem to call session_start() in your page anywhere. You can't destroy a session without starting it first.


Instead of using a meta refresh, why not direct them back to index.php with a header?

<?php
  $_SESSION = array();
  session_destroy();
  header('Location: index.php');
?>


Change your content="0 to 20. Try viewing the source to be sure that you're page is not showing this meta tag. If it is, fix the bug. If it's not, then it's something else.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号