php如何读取出一个文件夹及其子文件夹下所有文件
代码如下:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
$path = './use' ;
$result = scanFile( $path );
function scanFile( $path ) {
global $result ;
$files = scandir( $path );
foreach ( $files as $file ) {
if ( $file != '.' && $file != '..' ) {
if ( is_dir ( $path . '/' . $file )) {
scanFile( $path . '/' . $file );
} else {
$result [] = basename ( $file );
}
}
}
return $result ;
}
|
/php/27915.htmlwww.phpzy.comtrue/php/27915.htmlTechArticlephp如何读取出一个文件夹及其子文件夹下所有文件 代码如下: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 $path = './use' ; $result = scanFile( $path ); function scanFile( $path ) { global $result ; $files = scandir( $path )...
相关文章
- 暂无相关文章
PHP之友评论