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条)

报告相同问题?

悬赏问题

  • ¥50 求恶意流量检测系统搭建教程( C++ python C)
  • ¥15 mmseqs内存报错
  • ¥15 vika文档如何与obsidian同步
  • ¥15 华为手机相册里面的照片能够替换成自己想要的照片吗?
  • ¥15 陆空双模式无人机飞控设置
  • ¥15 sentaurus lithography
  • ¥100 求抖音ck号 或者提ck教程
  • ¥15 关于#linux#的问题:子进程1等待子进程A、B退出后退出(语言-c语言)
  • ¥20 web页面如何打开Outlook 365的全球离线通讯簿功能
  • ¥15 io.jsonwebtoken.security.Keys