php递归遍历文件夹
// 递归遍历文件夹
function test($dirs) {
$base_dir = $dirs;
foreach (scandir($dirs) as $file) {
if (is_file($file)) {
echo "文件:".$file."
";
} else if (is_dir($file) && $file != "." && $file != "..") {
echo "文件夹:".$file."
";
call_user_func("test",$base_dir.$file);
//test($base_dir.$file);
}
}
}
test("/var/www/test/");
声明:该文观点仅代表作者本人,入门客AI创业平台信息发布平台仅提供信息存储空间服务,如有疑问请联系rumenke@qq.com。
- 上一篇:没有了
- 下一篇:没有了
