【问题标题】:How to watch which php files have been executed within a period of time?如何查看一段时间内执行了哪些php文件?
【发布时间】:2018-11-15 14:12:30
【问题描述】:

一些网站文章图片经常被删除。我想要一个工具可以观察一段时间内执行了哪些php文件。

windows server2008 R2环境为apache+mysql

【问题讨论】:

  • Apache access_log 记录对特定 URL 的每次访问。它可以帮助
  • What topics can I ask about here? 说这个问题在这里是题外话。
  • @Humba 谢谢 :)
  • @KenWhite 谢谢 :) 我会读的。

标签: php windows-server


【解决方案1】:

使用它来获取文件名:

 $fname=   $_SERVER["SCRIPT_FILENAME"];

$fname=  basename(__FILE__, '.php'); //without extension

并使用它记录到一个文件中:

$logfile = fopen("log.txt", "w") or die("Unable to open file!");
$txt = $fname;
fwrite($logfile, $txt);
$ts=time();
fwrite($logfile, $ts);
fclose($logfile);

你可以将它包装在一个函数中,并在每个 php 文件的开头调用它。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2010-12-14
    • 2014-10-25
    • 2020-11-14
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多