如何查看一段时间内执行了哪些php个文件?

How to watch which php files have been executed within a period of time?

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

环境是apache+mysql on windows server2008 R2

使用这个获取文件名:

 $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 文件的开头调用它。