donglu6303 2010-12-20 21:59
浏览 27
已采纳

有没有办法用PHP清空会话文件?

I'm wondering if I can destroy/modify sessions in a native PHP way that doesn't involve file I/O directives.

I'm not talking about $_SESSION, I mean access to the session files themselves.

For instance, PHP stores sessions on linux as files:

@lamp:/var/lib/php5$ ls
sess_301dc8935f1775312e9007431782c68b
sess_6892f0bec257e646d193adfd91233c40
sess_966909941003dd6fd333727d8862be6e
sess_cb7c07117cef89674a686ffff8a730f2
sess_ffb4db1d9002741b7e0fcc02090b9aaa
sess_305aeb0fdba7548e389394cb31d77c3b
.... etc

$_SESSION gives us the value of what's inside a current session, and the session_start() and session_destroy() will terminate the current session identifier.

I want to know if I can destroy or modify sessions globally in a native way to php that doesn't resort to me having to do fopen(/var/lib/php5/sess_whatever), I don't want to work with the current session, I want a script to be able to either delete or modify sessions outside of what $_SESSION, session_start, and session_stop do, as they force you to use the present session.

  • 写回答

2条回答 默认 最新

  • dongzhiman2162 2010-12-21 14:36
    关注

    Sounds to me like you can't have it both ways. Session handling functions are built to interact with the current session. In order to manipulate other sessions you will have to go the whole fopen() route.

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

报告相同问题?

悬赏问题

  • ¥40 复杂的限制性的商函数处理
  • ¥15 程序不包含适用于入口点的静态Main方法
  • ¥15 素材场景中光线烘焙后灯光失效
  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码