时间:2021-07-01 10:21:17 帮助过:23人阅读
/** * Returns a human readable filesize * * @author wesman20 (php.com) * @author Jonas John * @version 0.3 */ function HumanReadableFilesize($size) { // Adapted from: http://www.php.com/manual/en/function.filesize.php $mod = 1024; $units = explode(' ','B KB MB GB TB PB'); for ($i = 0; $size > $mod; $i++) { $size /= $mod; } return round($size, 2) . ' ' . $units[$i]; }