PHP无需循环计算容量单位(B KB MB GB TB)
本文地址:http://tongxinmao.com/Article/Detail/id/300
$bytes = disk_free_space("."); $si_prefix = array( 'B', 'KB', 'MB', 'GB', 'TB', 'EB', 'ZB', 'YB' ); $base = 1024; $class = min((int)log($bytes , $base) , count($si_prefix) - 1); echo $bytes . '<br />'; echo sprintf('%1.2f' , $bytes / pow($base,$class)) . ' ' . $si_prefix[$class] . '<br />';
上一篇:HP DeskJet 1110 series 喷墨打印机USB描述符
下一篇:服务器