Home  >  Article  >  Backend Development  >  如何使在网页上点击退出登录后,清除session呢?求教

如何使在网页上点击退出登录后,清除session呢?求教

WBOY
WBOYOriginal
2016-06-13 13:32:561524browse

怎么使在网页上点击退出登录后,清除session呢?求教!
function clear1(){
    $_SESSION[allow]=NULL;
  $_SESSION[auth]=NULL;
  $power[0]=NULL;
  ?>
  window.location='index.php';
}
这样子不行,开始的时,就清空了,

怎 么使点击退出以后,触发事件清空session()///session.clear();

------解决方案--------------------
将这个方法放到另一个文件中.单击事件时调用.
------解决方案--------------------

探讨

将这个方法放到另一个文件中.单击事件时调用.

------解决方案--------------------
给退出按钮传入个action=logout的GET参数,在php里就可以判断之后unset掉相关session数据或者destroy了。
------解决方案--------------------
session进行时间判定就可以了!
点击的退出的时候,进行seseion的保存时间小于当前时间!
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn