//文件大小单位自动转换
public static function autoShow($value = 0)
{
$kb = 1024;
$mb = 1048576;
$gb = 1073741824;
$tb = $gb * 1024;
$pb = $tb * 1024;
if (abs($value) > $pb) {
return round($value / $pb, 2) . "PB";
} elseif (abs($value) > $tb) {
return round($value / $tb, 2) . "TB";
} elseif (abs($value) > $gb) {
return round($value / $gb, 2) . "GB";
} elseif (abs($value) > $mb) {
return round($value / $mb, 2) . "MB";
} elseif (abs($value) > $kb) {
return round($value / $kb, 2) . "KB";
} else {
return round($value, 2) . "B";
}
}