Blogger Information
Blog 87
fans 0
comment 0
visits 59077
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
第七章:3、遍历目录
黄忠倚的博客
Original
847 people have browsed it

实例

<?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>';
	}
}

运行实例 »

点击 "运行实例" 按钮查看在线实例


Correction status:qualified

Teacher's comments:
Statement of this Website
The copyright of this blog article belongs to the blogger. Please specify the address when reprinting! If there is any infringement or violation of the law, please contact admin@php.cn Report processing!
All comments Speak rationally on civilized internet, please comply with News Comment Service Agreement
0 comments
Author's latest blog post