递归读取目录
<?php
/**
* @param $path 路径
*/
function readDirs($path){
//打开
$dir_handler = opendir($path);
while (false !== $file = readdir($dir_handler)) {
if($file=='.'|| $file=='..') continue;
//输出
echo $file,'<br />';
//判断当前是否为子目录,递归
if(is_dir($path.'/'.$file)){
readDirs($path.'/'.$file);
}
}
}
//调用
$path = 'D:\WWW\php34';
readDirs($path);