function get_dir_info($path){$handle = opendir($path);//打开目录返回句柄while(($content = readdir($handle))!== false){$new_dir = $path . DIRECTORY_SEPARATOR . $content;if($content == '..' || $content == '.'){continue;}if(is_dir($new_dir)){echo "<br>目录:".$new_dir . '<br>';get_dir_info($new_dir);}else{echo "文件:".$path.':'.$content .'<br>';}}}get_dir_info($dir);