這篇文章主要介紹了PHP獲取文件夾內文件數的方法,涉及php操作文件夾及文件的技巧,具有一定參考借鑒價值,需要的朋友可以參考下
本文實例講述了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程序設計有所幫助。
新聞熱點
疑難解答