drgaeqdqiiyg14608 2012-05-09 10:34
浏览 34
已采纳

如何在mac os中关闭浏览器时销毁会话?

I am working on php project. All I want to do that, when I close the browser so unset or destroy the session.

Here I also tried

ini_set('session.cookie_lifetime', 0) and session_set_cookie_params(0) before session_start();

It's working fine in Windows os but not in MAC os.

Thanks in Advance.

  • 写回答

2条回答 默认 最新

  • dpnvrt3119 2012-05-09 10:40
    关注

    There are two parts to a session.

    1. The data stored on the server
    2. The cookie with the session id on the client

    There is no reliable way to delete the data on the server when the browser is closed. Every sane session system just cleans up old data periodically (if there has been no sign of the associated browser for N minutes).

    The cookie on the browser is usually sent without an expiry time, which means it will expire when the browser exits. This works reliably.

    If whatever you have is doing what you want on Windows clients, then I would assume that you are talking about expiring the cookie.

    This will happen on Mac as well as Windows. My best guess is that there is a problem with your testing. On Windows, applications generally exit when the last window is closed. On Mac, applications generally require that you explicitly quit them but remain open if you just close the last window.

    To make sure the cookie expires you must expressly exit the browser (by picking Quit from the menu or right clicking and picking exit on the icon in the Dock).

    There is no way for the server to detect when the last window has been closed and kill the session remotely.

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

报告相同问题?

悬赏问题

  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度
  • ¥30 关于#r语言#的问题:如何对R语言中mfgarch包中构建的garch-midas模型进行样本内长期波动率预测和样本外长期波动率预测
  • ¥15 ETLCloud 处理json多层级问题
  • ¥15 matlab中使用gurobi时报错
  • ¥15 这个主板怎么能扩出一两个sata口
  • ¥15 不是,这到底错哪儿了😭
  • ¥15 2020长安杯与连接网探
  • ¥15 关于#matlab#的问题:在模糊控制器中选出线路信息,在simulink中根据线路信息生成速度时间目标曲线(初速度为20m/s,15秒后减为0的速度时间图像)我想问线路信息是什么