php获取文件的大小
解决方法:
$filename = "F:/standard.jar";
@clearstatcache();
if(file_exists($filename)){
$filesize = filesize($filename).'B';
if($filesize > 1000000){
$filesize = $filesize/1000000;
$filesize = sprintf("%.2f", $filesize);
$filesize .= 'MB';
}else{
if($filesize > 1000){
$filesize = $filesize/1000;
$filesize = sprintf("%.2f", $filesize);
$filesize .= 'KB';
}else{
$filesize .= 'B';
}
}
}
echo $filesize;