php 容量格式化 函数
容量格式化 函数 [代码片段(15行)]
/**
* 容量格式化
*
* @param Int $filesize
* @return Srting
*/
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://outofmemory.cn
- 上一篇:php 分析用户ip归属地
- 下一篇:php 字符串截取, 支持常用编码
精彩图集
精彩文章






