本文實例講述了PHP獲取文件夾內文件數的方法。分享給大家供大家參考。具體實現方法如下:
function getfilecounts($ff){
$dir = './'.$ff;
$handle = opendir($dir);
$i = 0;
while(false !== $file=(readdir($handle))){
if($file !== '.' && $file != '..')
{
$i++;
}
}
closedir($handle);
return $i;
}
希望本文所述對大家的php程序設計有所幫助。