Home >Backend Development >PHP Tutorial >php如何保存一棵树

php如何保存一棵树

WBOY
WBOYOriginal
2016-06-13 10:48:431112browse

php怎么保存一棵树
现在有个文件目录是树形结构

现在准备用php遍历这个目录结构

如果目录里面是文件的话 就不保存 
如果目录里面是目录的话 就保存


遍历可以用递归来遍历 该怎么保存这棵目录树呢

因为保存起来 后期有用 求大牛指点 跪谢!祝好心人一生平安

------解决方案--------------------
目录不断更新变化,那么只能动态读取了。比如

PHP code
$res = glob('phpmyadmin/*', GLOB_ONLYDIR);for($i=0; $i<count glob_onlydir as array_merge glob></count><font color="#e78608">------解决方案--------------------</font><br>$objects = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($path));<br><br>自己查文献<br><br>可以用->isFile()判断<br><div class="clear">
                 
              
              
        
            </div>
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
Previous article:Php群解决方法Next article:win7中配备php环境