1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | /** * PHP转换字节数为可视单位 * * * @param string $filesize 字节大小 * @return string 返回大小 */ function sizecount($filesize) { if ($filesize >= 1073741824) { $filesize = round($filesize / 1073741824 * 100) / 100 .' GB'; } elseif ($filesize >= 1048576) { $filesize = round($filesize / 1048576 * 100) / 100 .' MB'; } elseif($filesize >= 1024) { $filesize = round($filesize / 1024 * 100) / 100 . ' KB'; } else { $filesize = $filesize.' Bytes'; } return $filesize; } |
- 本文固定链接: http://www.web8899.com/php/200.html
- 转载请注明: 郑 国华 于 迈向卓越 发表