Регистрация Войти
Войти через VK Войти через FB Войти через Google Войти через Яндекс
Войти через VK Войти через FB Войти через Google Войти через Яндекс
Поиск по сайту
Наш чат в Telegram для обмена идеями, проектами, мыслями, людьми в сфере ИТ г.Ростова-на-Дону: @it_rostov
Удаление устаревших файлов.
$files = glob('imagecache/*', GLOB_BRACE);
usort($files, 'filemtime_compare');
function filemtime_compare($a, $b)
{
return filemtime($a) - filemtime($b);
}
$i = 0;
$show = 1000;
$today = mktime(date('h,i,s,m,d,Y'));
$onemonth = $today-47645;
foreach($files as $file)
{
if($i == $show) break; else ++$i;
$fileunixtime = filemtime($file);
if ($fileunixtime <= $onemonth) unlink($file);
}