欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

php獲取文件大小的方法

 更新時(shí)間:2014年02月26日 10:42:18   作者:  
這篇文章主要介紹了php獲取文件大小的方法,需要的朋友可以參考下
復(fù)制代碼 代碼如下:

static function convert($size) {
        $unit=array('b','kb','mb','gb','tb','pb');
        return @round($size/pow(1024,($i=floor(log($size,1024)))),2).' '.$unit[$i];
    }


也可用下面這種方法

復(fù)制代碼 代碼如下:


/**
 * Returns a human readable filesize
 */
function HumanReadableFilesize($size) {
    $mod = 1024;
    $units = explode(' ','B KB MB GB TB PB');
    for ($i = 0; $size > $mod; $i++) {
        $size /= $mod;
    }
    return round($size, 2) . ' ' . $units[$i];
}

相關(guān)文章

最新評(píng)論