0

这是我的代码:

 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 无法读取修改时间,也不知道为什么。请帮我。

4

1 回答 1

1
-$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'
于 2012-08-03T05:21:57.067 回答