- function format_bytes($size,$r) {
- $units = array("B", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB");
- for ($i = 0; $size >= 1024 && $i < 4; $i++) $size /= 1024;
- return round($size,$r).$units[$i];
- }
- //$r为小数点后位数
- //该片段来自于http://www.codesnippet.cn/detail/190620149838.html
来源: http://www.codesnippet.cn/detail/190620149838.html