您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息

php 文件大小格式化

2024/3/6 21:50:52发布22次查看
无详细内容 无 /** * 文件大小格式化 * @param integer $size 初始文件大小,单位为byte * @return array 格式化后的文件大小和单位数组,单位为byte、kb、mb、gb、tb */function file_size_format($size = 0, $dec = 2) { $unit = array(b, kb, mb, g
/** * 文件大小格式化 * @param integer $size 初始文件大小,单位为byte * @return array 格式化后的文件大小和单位数组,单位为byte、kb、mb、gb、tb */function file_size_format($size = 0, $dec = 2) { $unit = array(b, kb, mb, gb, tb, pb); $pos = 0; while ($size >= 1024) { $size /= 1024; $pos++; } $result['size'] = round($size, $dec); $result['unit'] = $unit[$pos]; return $result['size'].$result['unit'];}echo file_size_format(123456789);
该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录 Product