php基础练习--目录遍历:
<?php /** * listdir */ header("content-type:text/html;charset=utf-8"); $dirname = "./final/factapplication"; function listdir($dirname) { $ds = opendir($dirname); while (false !== ($file = readdir($ds))) { $path = $dirname.'/'.$file; if ($file != '.' && $file != '..') { if (is_dir($path)) { listdir($path); } else { echo $file."<br>"; } } } closedir($ds); } listdir($dirname);