有谁知道一种方法来获取文件夹中所有文件的最后修改日期并将其与某个日期进行比较?
到目前为止,我有这个。
<?php
$lastmoddate = (date("Ymd", filemtime($file)));
$todaysdate = date("Ymd", time());
$result = array();
$folder = ('uploaded_files/');
$handle = opendir($folder);
foreach (glob("$folder/*") as $team){$sort[]= end(explode('/',$team));}
while (false !==($file = readdir($handle)))
{
if ( $file != ".." && $file != "." )
{
$file = "uploaded_files/".$file ;
if (!is_dir($file))
$result[] = $file;
}
}
closedir($handle);
foreach ($result as $file){
if ($lastmoddate > $todaysdate){
if (strpos($file, "+12:00") !==false){
echo "$file".",".date ("h:i d/m/Y", filemtime($file))."\r\n"."<br/>";
}
}
}
?>
这不起作用,因为 $lastmoddate = 给了我日期 1969 12 31。