// 遍历上传文件的html文件,并返回html文件列表
private function readDir($dirPath){
$fileList = array();
if(is_dir($dirPath)){
$dir = opendir($dirPath);
while(($file = readdir($dir)) !== false){
if($file === '.' || $file === '..'){
continue;
}
if(strstr($file, '.') === false){
$fileList = array_merge($fileList, $this->readDir($dirPath.'/'.$file));
} else {
$file = explode('.', $file);
if($file[1] === 'html' || $file[1] === 'htm') {
$fileList = array_merge($fileList, array( array( 'name' => $file[0], 'path' => $dirPath.'/'.$file[0].'.'.$file[1])));
}
}
}
}
closedir($dir);
return $fileList;
}
转载于:https://my.oschina.net/wefatory/blog/625991