阿姨丝袜,异界大矿主,黄炳馀
php 版:
function format($size)
{
$sizetext = array(" b", " kb", " mb", " gb", " tb", " pb", " eb", " zb", " yb");
return round($size/pow(1024,($i=floor(log($size,1024)))),2).$sizetext[$i];
}
c# 版:
public string formatsize(long size)
{
if (size == 0) return "0";
string[] sizetext = new string[] { " b", " kb", " mb", " gb", " tb", " pb" };
int i = (int)math.floor(math.log(size, 1024));
return math.round(size / math.pow(1024, i), 2).tostring() + sizetext[i];
}
如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!!
点击进行留言回复
网友评论