doudi2005 2015-02-24 14:34
浏览 35
已采纳

从python中销毁会话,执行php脚本

I created a python script for managing a multi tenant system on my server. The goal is to log out user sessions through the same script in python, executing a PHP script like this:

log_out_users.php

<?php

session_start();

session_unset();

session_destroy();

?>

with this Python code:

import subprocess

command = "php /var/www/tenant/log_out_users.php"
subprocess.call(command, shell=True)

The script runs correctly, but the session is not destroyed. It doesn't even work if I call the php file from CLI, entering into the tenant folder and running the command

php log_out_users.php

Any hints?

  • 写回答

1条回答 默认 最新

  • dongle7882 2015-02-25 15:39
    关注

    I solved it by denying access to users via .htaccess, in this way.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 使用yolov5-7.0目标检测报错
  • ¥15 对于这个问题的解释说明
  • ¥200 询问:python实现大地主题正反算的程序设计,有偿
  • ¥15 smptlib使用465端口发送邮件失败
  • ¥200 总是报错,能帮助用python实现程序实现高斯正反算吗?有偿
  • ¥15 对于squad数据集的基于bert模型的微调
  • ¥15 为什么我运行这个网络会出现以下报错?CRNN神经网络
  • ¥20 steam下载游戏占用内存
  • ¥15 CST保存项目时失败
  • ¥20 java在应用程序里获取不到扬声器设备