如果你想列出目录下的所有文件,使用以下代码即可:
1 function listDirFiles( $DirPath ){
2
3 if ( $dir = opendir ( $DirPath )){
4
5 while (( $file = readdir ( $dir ))!== false ){
6
7 if (! is_dir ( $DirPath . $file ))
8
9 {
10
11 echo "filename: $file <br >" ;
12
13 }
14
15 }
16
17 }
18
19 }
20
21 // 使用方法如下
22
23 listDirFiles('home/some_folder/');
声明:本文来自网络,不代表【好得很程序员自学网】立场,转载请注明出处:http://www.haodehen.cn/did29813