VetalDX Posted February 16, 2015 Share Posted February 16, 2015 (edited) Здравствуйте. Помогите, не как не могу сделать время о выводе когда был загружен последний файл на сервер в каталог.Вот сам скрипт: <?php function file_size ($filename) { if (!file_exists($filename)) return "file missing"; $filesize = filesize($filename); if($filesize > 1024) { $filesize = ($filesize/1024); if($filesize > 1024) { $filesize = ($filesize/1024); if($filesize > 1024) { $filesize = ($filesize/1024); $filesize = round($filesize, 1); return $filesize." ГБ"; } else { $filesize = round($filesize, 1); return $filesize." MБ"; } } else { $filesize = round($filesize, 1); return $filesize." Кб"; } } else { $filesize = round($filesize, 1); return $filesize." байт"; } } foreach (glob("*.dem.bz2") as $filename) { sort($files); echo '<table width="100%" cellspacing="0" cellpadding="0" align="center" class="listtable"> <tr> <td width="20%" height="25" class="listtable_top" align="left"><b>Имя файла</b></td> <td width="20%" height="25" class="listtable_top" align="center"><b>Размер файла</b></td> <td width="20%" height="25" class="listtable_top" align="center"><b>Автор файла</b></td> <td width="20%" height="25" class="listtable_top" align="center"><b>Дата и Время</b></td> <td width="20%" height="25" class="listtable_top" align="center"><b>Загрузить</b></td> </tr> <tr> <td width="20%" height="25" class="listtable_name" align="left">'.$filename.'</td> <td width="20%" height="25" class="listtable_size" align="center">'.file_size($filename).'</td> <td width="20%" class="listtable_author"></td> <td width="20%" class="listtable_data" align="center"></td> <td width="20%" height="25" class="listtable_download" align="center"><a href = "'.$filename.'" class="download_button rounded right">Загрузить</a></td> </tr> </table>'; } ?> ? Edited February 16, 2015 by VetalDX Link to comment Share on other sites More sharing options...
siv1987 Posted February 16, 2015 Share Posted February 16, 2015 Так время последнего файла в каталоге или время файла? http://php.net/manual/ru/function.filemtime.phpecho date('Y-m-d H:i', filemtime($filename)); <td width="20%" class="listtable_data" align="center">'.date('Y-m-d H:i', filemtime($filename)).'</td> 1 Link to comment Share on other sites More sharing options...
VetalDX Posted February 17, 2015 Author Share Posted February 17, 2015 Спасибо Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now