2012-08-03 41 views
0

這裏是我的代碼:filemtime無法讀取文件修改時間

date_default_timezone_set('Europe/Baku'); 
     $dh =opendir('C:\Program Files (x86)\Zend\Apache2\htdocs\upload\extjs-4.1.1\welcome\css'); 
     $full_path='C:\Program Files (x86)\Zend\Apache2\htdocs\upload\extjs-4.1.1\welcome\css'; 
     $way=array(); 

     while ($file = readdir($dh)): 

     array_push($way,$full_path.$file); 
     endwhile; 
     closedir($dh); 
     echo '<br>'; 
     for ($t=2;$t<=6;$t++){ 
     echo "<br> $way[$t] : " . filetype($way[$t]) . "\nCreate Date: " . date("F d Y      H:i:s ", filemtime((string)$way[$t])); 

     } 


echo '<br>'.date ("F d Y H:i:s.", filemtime('C:\Program Files (x86)\Zend\Apache2\htdocs\upload\extjs-4.1.1\welcome\css\blank.gif')); 

     ?> 

,這就是它的響應:

C:\Program Files (x86)\Zend\Apache2\htdocs\upload\extjs-4.1.1\welcome\cssblank.gif : Create Date: January 01 1970 00:00:00 C:\Program Files (x86)\Zend\Apache2\htdocs\upload\extjs-4.1.1\welcome\cssiepngfix.htc : Create Date: January 01 1970 00:00:00 C:\Program Files (x86)\Zend\Apache2\htdocs\upload\extjs-4.1.1\welcome\csswelcome.css : Create Date: January 01 1970 00:00:00 C:\Program Files (x86)\Zend\Apache2\htdocs\upload\extjs-4.1.1\welcome\csswelcome_ie6.css : Create Date: January 01 1970 00:00:00 : Create Date: January 01 1970 00:00:00 July 04 2012 16:13:34.

我認爲filemtime無法讀取修改時間不知道爲什麼。 請幫幫我。

回答

0
-$full_path='C:\Program Files (x86)\Zend\Apache2\htdocs\upload\extjs-4.1.1\welcome\css'; 
+$full_path='C:\Program Files (x86)\Zend\Apache2\htdocs\upload\extjs-4.1.1\welcome\css\'; 

您在full_path變量中丟失了反斜線。 所以,你得到錯誤的完整路徑文件:

'C:\Program Files (x86)\Zend\Apache2\htdocs\upload\extjs-4.1.1\welcome\csswelcome.css' 

,而不是

'C:\Program Files (x86)\Zend\Apache2\htdocs\upload\extjs-4.1.1\welcome\css\welcome.css' 
+0

感謝名單快速的答案。在這種情況下,我是新手) – Sam 2012-08-03 05:41:31