Blogger Information
Blog 22
fans 0
comment 0
visits 17791
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
0108文件操作及遍历目录
yestrue的博客
Original
780 people have browsed it
<?php
header('Content-type:text/html; charset=utf8');
echo '<pre>';
$path = 'D:\www\test\180108hw\scandir.php';
echo '原路径:',$path,'<br>';
echo '当前文件名',basename($path),'<br>';
echo '当前文件所在完整目录:',dirname($path),'<br>';
print_r(pathinfo($path));

$dir = 'D:\www\test\180108hw';
function list_dir($dir){
	foreach(scandir($dir) as $temp){
		if($temp == '.' || $temp == '..'){
			continue;
		}
		if(is_dir($dir.'/'.$temp)){
			list_dir($dir.'/'.$temp);
		}else{
			echo $dir.'/'.$temp.'<br>';
		}
	}
}
list_dir($dir);


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