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