2013-03-06 3 views
0

나는 사이트 맵의 모든 html 파일의 마지막 수정 시간을 확인하는 웹 페이지에서 직접 실행되는 php 스크립트를 가지고 있습니다. 그러나 오류가 발생하면 cron 작업으로 실행합니다.파일 시간에 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는/널 & & 에코 $ (일) >>은/var// cron.log

오류 PHP 경고 로그 "사이트 맵 완료" : filemtime() : stat failed

내가 무엇을 바꿔야하는지에 대한 아이디어가 있으십니까?

답변

1

다른 디렉토리에 있습니다. 다음 중 하나를

chdir($path); 

또는 :

filemtime($path.DIRECTORY_SEPARATOR.$file); 
+0

많은 감사합니다. 해결 방법은 "filemtime ($ path.DIRECTORY_SEPARATOR. $ file)"입니다. –

관련 문제