中分別獲取每個文件的大小,任何人都可以幫助我從本地目錄單獨獲取每個文件大小?如何從目錄PHP
$files = scandir('soft');
foreach($files as $file) {
echo $file . "<br />";
}
中分別獲取每個文件的大小,任何人都可以幫助我從本地目錄單獨獲取每個文件大小?如何從目錄PHP
$files = scandir('soft');
foreach($files as $file) {
echo $file . "<br />";
}
<?
$files = scandir('.');
foreach($files as $file) {
echo filesize($file) . " bytes<br>";
}
?>
使用filesize($filename)
PHP函數,它會給字節大小
'$ file' - >'echo filesize('soft /'.$ file)。 'bytes';'而不是'$ filename' - >'echo filesize('soft /'.$ filename)。 'bytes';' – Sean
對不起,我很着急,你說得對,修改過。謝謝 ! –
謝謝,但即時通訊有問題,您的代碼顯示每個文件4096個字節,並回顯兩個額外的大小哪些文件不存在。 – Sahed