我有以下代码从目录中读取所有CSV文件并输出内容。它可以正常工作,但是按文件名排列-如何修改以按CSV创建的日期排序?
foreach (array_reverse(glob("./csv/*.csv")) as $filename) {
$f = fopen("$filename", "r");
while (($line = fgetcsv($f)) !== false) {
$i++;
echo "<tr class='row-$i'>";
foreach ($line as $cell) {
echo "<td>" . htmlspecialchars($cell) . "</td>";
}
echo "</tr>\n";
}
fclose($f);
echo "\n";