Ben son değiştirilme zaman ters sırayla görüntüleri görüntülemek için çalışıyorum. Ne yazık ki, get_headers () sadece URL'ler için iş gibi görünüyor ve her iki istatistik ['mtime'] ve filemtime () benim için başarısız. Bir dosyanın son değiştirilme bilgi almak için beni başka yolları var mı? İşte şu anda benim kod:
if (isset($_GET['start']) && "true" === $_GET['start'])
{
$images = array();
if ($dir = dir('images'))
{
$count = 0;
while(false !== ($file = $dir->read()))
{
if (!is_dir($file) && $file !== '.' && $file !== '..' && (substr($file, -3) === 'jpg' || substr($file, -3) === 'png' || substr($file, -3) === 'gif'))
{
$lastModified = filemtime($file);
$images[$lastModified] = $file;
++$count;
}
}
echo json_encode($images);
}
else { echo "Could not open directory"; }
}