我们先来看遍历目录
read()) { if ((is_dir($directory/$file)) and ($file != .) and ($file != ..)) { echo $filen; tree($directory/$file); } else echo $filen; } echo n; $mydir->close();}//开始运行echo 目录为粉红色
n;tree(./phprm);?>
这样只是把所有目录下的文件显示了,但我们要判断大小需加上round(filesize($cpath)/1024,1)函数了,这样我们获取大小之后就可以显示文件大小了。
$limitbyte) { $arrres[] = array( $cpath, round(filesize($cpath) / 1024, 1) ); //echo {$cpath}
.(filesize($cpath) / 1024).kb
; } } } } } closedir($h);}foreach ($arrres as $k => $v) { $arrtmp[$k] = $v[1];}arsort($arrtmp);foreach ($arrtmp as $k => $v) { echo . str_replace($dirpath, '', $arrres[$k][0]) .
. $arrres[$k][1] .
;}?>
最后给大家附一个字节计算函数,这个可以转换
