請大家多批評指正!!! //List.php //Power by Devchina.com 2oa.net $Path=($dir)?urldecode($dir):"d:";//最好用session設置路徑安全 $handle=opendir($Path); while ($file = readdir($handle)) { $newpath=$Path."/".$file; if($file==".." or $file==".") { //你可以把..或者.加上連接作為回上一層的"; continue; } if(is_dir($newpath)){ $p[intval(filemtime($newpath))]=$file; }else { $f[intval(filemtime($newpath))]=$file; } } echo "排序規則:按時間 升(最老的文件在最前面) 降(最新的文件在最前面)"; $cd=($order=="up")?sizeof(@ksort($p)):sizeof(@krsort($p)); $cf=($order=="up")?sizeof(@ksort($f)):sizeof(@krsort($f)); if($cd>0){ while(list($key,$val)=each($p)){ echo "
"; echo " $val"; echo " 創建時間:".@date("Y-m-j:H:i:s",$key).""; } } unset($p); unset($cd); if($cf>0){ while(list($key,$val)=each($f)){ echo "
"; echo " $val"; echo " 創建時間:".@date("Y-m-j:H:i:s",$key).""; } } unset($f); unset($cf); closedir($handle); ?>