dongzhi4073 2016-09-30 15:51
浏览 3058

使用Expires / Max-Age of Session删除cookie

When I look in my chrome dev tools (Cookies section) you have 5 relevant columns: Name, Value, Domain, Path and Expires / Max-Age I have a cookie that I can't delete with and Expires / Max-Age of Session. The odd thing is that when I inspect with x-debug it doesnt show up under $_SESSION it shows up under $_COOKIE.

I first tried deleting with JS, this worked on my local environment but when I pushed it up to a staging server the cookie wasnt being deleted.

Next I tired deleting it with PHP since it is my understanding that session cookies cant be deleted with js but when trying to delete the cookie with setcookie, or something like

    setcookie (session_id(), "", time() - 3600);
    session_destroy();
    session_write_close();

I still have no luck, any suggestions?

  • 写回答

2条回答 默认 最新

  • doushi2902 2016-09-30 15:54
    关注

    Set the time to Thu, 01-Jan-1970 00:00:01 GMT. I believe it will solve the problem

    评论

报告相同问题?

悬赏问题

  • ¥15 如何用stata画出文献中常见的安慰剂检验图
  • ¥15 c语言链表结构体数据插入
  • ¥40 使用MATLAB解答线性代数问题
  • ¥15 COCOS的问题COCOS的问题
  • ¥15 FPGA-SRIO初始化失败
  • ¥15 MapReduce实现倒排索引失败
  • ¥15 ZABBIX6.0L连接数据库报错,如何解决?(操作系统-centos)
  • ¥15 找一位技术过硬的游戏pj程序员
  • ¥15 matlab生成电测深三层曲线模型代码
  • ¥50 随机森林与房贷信用风险模型