<?php 
$ar = array();$d = dir(".");
while($f = $d->read()) {
  $ar['name'][] = $f;
  $ar['type'][] = is_dir($f) ? "dir" : "file";
  $ar['time'][] = date("Y-m-d H:i:s",filectime($f));
  $ar['size'][] = filesize($f);
}
$d->close();array_multisort($ar['type'],$ar['name'],SORT_STRING,SORT_ASC,$ar['time'],SORT_DESC,$ar['size']);echo "<table>";
foreach($ar['name'] as $k=>$v)
  printf("<tr><td>%s</td><td>%s</td><td>%d</td><td>%s</td></tr>",$v,$ar['type'][$k]=="dir"?"[DIR]":"",$ar['size'][$k],$ar['time'][$k]);
echo "</table>";
?>

解决方案 »

  1.   

    测试了一下楼上的程序我的目录下面返回结果如下:. [DIR] 0 2004-08-16 09:13:51 
    .. [DIR] 0 2004-07-29 15:27:34 
    admin [DIR] 0 2004-08-16 09:13:51 
    db [DIR] 0 2004-08-16 09:13:51 
    includes [DIR] 0 2004-08-16 09:13:51 
    install [DIR] 0 2004-08-16 09:13:52 
    language [DIR] 0 2004-08-16 09:13:52 
    templates [DIR] 0 2004-08-16 09:13:52 
    admin_login.php  7765 2004-08-16 09:13:51 
    common.php  4099 2004-08-16 09:13:51 
    config.php  259 2004-08-16 09:28:24 
    extension.inc  757 2004-08-16 09:13:51 
    redme.doc  10752 2004-08-16 09:13:52 
    test.php  907 2004-08-16 09:13:52 
    test2.php  338 2004-09-22 15:10:00 
    设计说明文档.txt  369 2004-08-16 09:13:52 不错!!