function get_files($dir) {
$files = array();
if(!is_dir($dir)) {
return $files;
}
$handle = opendir($dir);
if($handle) {
while(false !== ($file = readdir($handle))) {
if ($file != ‘.‘ && $file != ‘..‘) {
$filename = $dir . "/" . $file;
if(is_file($filename)) {
$files[] = $filename;
}else {
$files = array_merge($files, get_files($filename));
}
}
} // end while
closedir($handle);
}
return $files;
}
$files = get_files("Lee");
var_dump($files);
时间: 2024-10-14 23:31:28