close
[php] disk_total_space 返回指定目錄的磁盤總大小
例子
<?php
echo disk_total_space("C:");
?>
輸出:
209693288558
<?php
$f = disk_total_space("/raid/vhost/treetech.tw/www/");
echo HumanSize($f);
function HumanSize($Bytes)
{
$Type=array("", "kilo", "mega", "giga", "tera", "peta", "exa", "zetta", "yotta");
$Index=0;
while($Bytes>=1024)
{
$Bytes/=1024;
$Index++;
}
return("".$Bytes." ".$Type[$Index]."bytes");
}
?>
全站熱搜