1 <?php 2 function my_scandir($dir){ 3 $files = array(); 4 if(is_dir($dir)){ 5 if($handle=opendir($dir)){ 6 while(($file=readdir($handle))!==false){ 7 if($file!="." && $file!=".."){ 8 if(is_dir(($dir."\".$file))){ 9 $files[$file] = my_scandir($dir."\".$file); 10 }else{ 11 $files[] = $dir."\".$file; 12 } 13 } 14 } 15 closedir($handle); 16 return $files; 17 } 18 } 19 } 20 echo "<pre>"; 21 print_r(my_scandir("E:wampwwwls002")); 22 echo "</pre>"; 23 ?>