//获取一个目录下所有文件
function getOneDirFiles( $path ) {
$list = array();
if( ( $hndl = @opendir( $path ) ) === false ) {
return $list;
}
while( ( $file = readdir( $hndl ) ) !== false ) {
if( $file != '.' && $file != '..' ) {
$list[] = $file;
}
}
closedir( $hndl );
return $list;
}
//循环读取一个文件夹下所有目录和文件(全部文件包含子文件)
function getDirFiles( $dir ) {
$files = array();
if( is_dir( $dir ) ) {
if( $handle = @opendir( $dir ) ) {
while( ( $file = readdir( $handle ) ) !== false ) {
if( $file != '.' && $file != '..' ) {
if( is_dir( $dir . '/' . $file ) ) {
$files[$file] = getDirFiles( $dir . '/' . $file );
}else{
$files[] = $dir . '/' . $file;
}
}
}
closedir( $handle );
return $files;
}
}
}
function getOneDirFiles( $path ) {
$list = array();
if( ( $hndl = @opendir( $path ) ) === false ) {
return $list;
}
while( ( $file = readdir( $hndl ) ) !== false ) {
if( $file != '.' && $file != '..' ) {
$list[] = $file;
}
}
closedir( $hndl );
return $list;
}
//循环读取一个文件夹下所有目录和文件(全部文件包含子文件)
function getDirFiles( $dir ) {
$files = array();
if( is_dir( $dir ) ) {
if( $handle = @opendir( $dir ) ) {
while( ( $file = readdir( $handle ) ) !== false ) {
if( $file != '.' && $file != '..' ) {
if( is_dir( $dir . '/' . $file ) ) {
$files[$file] = getDirFiles( $dir . '/' . $file );
}else{
$files[] = $dir . '/' . $file;
}
}
}
closedir( $handle );
return $files;
}
}
}

被折叠的 条评论
为什么被折叠?



