有意思的一个操作实例(需要在linux环境下跑)-PHP
程序员文章站
2022-05-19 20:29:58
...
=0 AND $unit/1024 1024 AND $unit/1024 <= 1024*1024 ) { $unit = 'M'; } else { $unit = 'G'; } } switch(strtolower($unit)) { case 'k': $size = ($size/1024); $suffix = 'KB'; break; case 'm': $size = ($size/1024/1024); $suffix = 'MB'; break; case 'g': $size = ($size/1024/1024/1024); $suffix = 'GB'; break; } $size = sprintf("%.2f%s", $size, $suffix); return $size; } $path = 'min'; var_dump(_dirSize($path, FALSE)); var_dump(_dirSize($path, TRUE)); var_dump(_getDirCount($path)); /*end of php*/