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 python爬取bilibili校园招聘网站
  • ¥30 求解达问题(有红包)
  • ¥15 请解包一个pak文件
  • ¥15 不同系统编译兼容问题
  • ¥100 三相直流充电模块对数字电源芯片在物理上它必须具备哪些功能和性能?
  • ¥30 数字电源对DSP芯片的具体要求
  • ¥20 antv g6 折线边如何变为钝角
  • ¥30 如何在Matlab或Python中 设置饼图的高度
  • ¥15 nginx中的CORS策略应该如何配置
  • ¥30 信号与系统实验:采样定理分析