0

サイトマップのすべてのhtmlファイルの最終変更時刻をチェックするWebページから直接正常に実行されるphpスクリプトがありますが、エラーが発生した場合は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"サイトマップが完了しました"$(date)>> / var / log / cron.log

エラーPHP警告:filemtime():統計に失敗しました

これのために私が何を変えるべきかについてのアイデアはありますか?

4

1 に答える 1

1

You are in another directory. Either:

chdir($path);

Or:

filemtime($path.DIRECTORY_SEPARATOR.$file);
于 2013-03-06T19:02:21.633 に答える