实例
<?php /医院 * 1.目录迭代器:DirectoryIterator * 2.目录递归迭代器:RecursiveDirectorIterator */ //1.目录迭代器:DirectoryIterator $dir = new DirectoryIterator('../0416'); foreach ($dir as $file) { // print $file->GetPathName().'<br>'; // if ($file->isFile()) { // print $file->GetPathName().'<br>'; // } if(!$file->isDot()) { print $file->GetPathName().'<br>'; } } echo '<hr>'; $dir = new RecursiveDirectoryIterator('../0416'); foreach (new RecursiveIteratorIterator($dir) as $file) { if($file->isFile()) { print $file->GetPathName().'<br>'; } }
运行实例 »
点击 "运行实例" 按钮查看在线实例