dongzhaobai5982 2014-02-20 17:59
浏览 121
已采纳

决定在PHP中注销

I have a website in which I set several variables like

$_SESSION["id"]

$_SESSION["email"]

$_SESSION["role"]

When user clicks on logout should I use session_destroy() or unset all the variables, it has no special impact on my site, but considering the fact that my sessions are stored on elastic cached with Redis? I think unless I do session_destroy() the session will not be removed from Redis,(thus occupying memory)

Any help?

  • 写回答

4条回答 默认 最新

  • dreamwind1985 2014-02-20 18:06
    关注

    Use session_destroy() if you are using it as a logout link, it will get rid of all session data without really having to worry about it. Just remember you have to refresh or redirect because the variables are still set on that page after you use session_destroy

    Source: Session unset, or session_destroy?

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(3条)

报告相同问题?

悬赏问题

  • ¥15 乌班图ip地址配置及远程SSH
  • ¥15 怎么让点阵屏显示静态爱心,用keiluVision5写出让点阵屏显示静态爱心的代码,越快越好
  • ¥15 PSPICE制作一个加法器
  • ¥15 javaweb项目无法正常跳转
  • ¥15 VMBox虚拟机无法访问
  • ¥15 skd显示找不到头文件
  • ¥15 机器视觉中图片中长度与真实长度的关系
  • ¥15 fastreport table 怎么只让每页的最下面和最顶部有横线
  • ¥15 java 的protected权限 ,问题在注释里
  • ¥15 这个是哪里有问题啊?