Php filetime上的Cron作业错误

Php filetime上的Cron作业错误,php,ubuntu,cron,Php,Ubuntu,Cron,我有一个php脚本,它可以直接从一个网页上运行,该网页可以检查所有html文件的最后修改时间,以查找站点地图,但是当我将其作为cron作业运行时,如果出现错误 下面是脚本、cron作业和错误 $path = "/home/mydir/"; // Open the folder $dir_handle = @opendir($path) or die("Unable to open $path"); // Loop through the files while ($file = re

我有一个php脚本,它可以直接从一个网页上运行,该网页可以检查所有html文件的最后修改时间,以查找站点地图,但是当我将其作为cron作业运行时,如果出现错误

下面是脚本、cron作业和错误

$path = "/home/mydir/"; 

// Open the folder 
$dir_handle = @opendir($path) or die("Unable to open $path"); 

// Loop through the files 
while ($file = readdir($dir_handle)) { 
    if($file == "." || $file == ".." || $file == "index.php" ) 

        continue; 
        if(strpos($file, ".html") !== false) {
        $a=filemtime($file);
        }
    }
}
php/home/mydir/pdate.php/dev/null&&echo“站点地图已完成”$(日期)>>/var/log/cron.log

错误 PHP警告:filemtime():stat失败


请问我该换什么

您在另一个目录中。 要么:

或:


非常感谢。使用解决方案“filemtime($path.DIRECTORY\u SEPARATOR.$file)”解决
chdir($path);
filemtime($path.DIRECTORY_SEPARATOR.$file);