我试图确定目录中文件的日期与当前日期之间的差异,我尝试了两种计算方法:
$fileUnixTimeDate = filemtime($file);
$fileFormattedDate = date('m/d/y',filemtime($file));
$todayUnixTimeDate = time();
$todayFormattedDate = date('m/d/y',time());
$unixDifference = $todayUnixTimeDate - $fileUnixTimeDate;
$formattedDifference = $todayFormattedDate - $fileFormattedDate;
这是目录中两个文件的结果: