Home  >  Article  >  php教程  >  文件字节大小格式化

文件字节大小格式化

WBOY
WBOYOriginal
2016-06-07 11:45:591522browse

字节格式化 把字节数格式为 B K M G T 描述的大小function byte_format($size, $dec=2){<br>     $a = array("B", "KB", "MB", "GB", "TB", "PB");<br>     $pos = 0;<br>     while ($size >= 1024) {<br>          $size /= 1024;<br>            $pos++;<br>     }<br>     return round($size,$dec)." ".$a[$pos];<br> }

AD:真正免费,域名+虚机+企业邮箱=0元

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn