分类:
2006-10-19 16:54:03
function getFiles($dir){
static $files = array();
static $func = __FUNCTION__;
if(is_dir($dir)){
foreach(scandir($dir) as $v){
if($v == '.' || $v == '..') continue;
$func($dir."/".$v);
}
}
else{
$files[] = $dir;
}
return $files;
}
function getFiles2 ($dir) {
static $files = array();
static $func = __FUNCTION__;
foreach (glob( $dir . '/*') as $v) {
if ( is_dir($v ) ) {
$func($v);
}
else {
$files[] = $v;
}
}
return $files;
}
print_r(getFile("d:/yct/"));
print_r(getFiles2 ("d:/yct/"));
?>