<?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!