Como listar archivos por fechas desde php
AUTOR PREGUNTA #1
-
¿Tienes la misma pregunta? Yo también
Esto también te interesa!
PREGUNTAS SIMILARES
#2
Luego lo reordenamos para listarlo
<?php
//ruta a la carpeta, '.' es carpeta actual
$path=".";
$no_mostrar=Array("",".","php");
$dir_handle = @opendir($path) or die("No se pudo abrir $path");
while ($file = readdir($dir_handle)) {
$pos=strrpos($file,".");
$extension=substr($file,$pos);
if (!in_array($extension, $no_mostrar)) {
$fechaarchivo=filemtime(dirname(__FILE__)."/".$file);
$archivos[$fechaarchivo]=$file;
}
}
closedir($dir_handle);
krsort($archivos);//REORDENO POR FECHAS
foreach ($archivos as $value) { // RECORRER EL ARREGLO ORDENADO
echo "<li><a href=\"$value\" id=\"enlace_$value\" title=\"$value\">$value</a></li>";
}
?>