This is a PHP directory traversal code that is good in terms of code and speed. Friends in need can refer to it.
代码如下 |
复制代码 |
$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)); |
http://www.bkjia.com/PHPjc/631704.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/631704.htmlTechArticleThis is a PHP directory traversal code that is pretty good in terms of code and speed. Friends in need can refer to it. . The code is as follows Copy the code $path = '..'; function get_filetree($path){ $t...
Statement: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