<?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);
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号