php最简单的遍历文件夹
<php //遍历文件夹 function list_file($dir){ $list = scandir($dir); $path=''; foreach($list as $v){ if($v=='.' || $v=='..')continue; $path = $dir.'/'.$v; if(is_dir($path)){ //echo '<a href="?p=',$path,'">',$v,'</a>' list_file($path); }else{ echo "$dir/$v<br>"; } } } $dir = dirname(__FILE__); list_file($dir);