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

报告相同问题?

悬赏问题

  • ¥20 测距传感器数据手册i2c
  • ¥15 RPA正常跑,cmd输入cookies跑不出来
  • ¥15 求帮我调试一下freefem代码
  • ¥15 matlab代码解决,怎么运行
  • ¥15 R语言Rstudio突然无法启动
  • ¥15 关于#matlab#的问题:提取2个图像的变量作为另外一个图像像元的移动量,计算新的位置创建新的图像并提取第二个图像的变量到新的图像
  • ¥15 改算法,照着压缩包里边,参考其他代码封装的格式 写到main函数里
  • ¥15 用windows做服务的同志有吗
  • ¥60 求一个简单的网页(标签-安全|关键词-上传)
  • ¥35 lstm时间序列共享单车预测,loss值优化,参数优化算法