Home > php教程 > php手册 > 目录递归循环php代码

目录递归循环php代码

WBOY
Release: 2016-05-25 16:56:38
Original
997 people have browsed it
这是一款从代码和速度上还不错的php目录遍历代码,有需要的朋友可以参考一下。
 代码如下 复制代码

$path = '..';
function get_filetree($path){
$tree = array();
foreach(glob($path.'/*') as $single){
if(is_dir($single)){
$tree = array_merge($tree,get_filetree($single));
}
else{
$tree[] = $single;
}
}
return $tree;
}
print_r(get_filetree($path));



source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template