RecursiveTreeIterator 输出递归树

最后更新于:2022-04-02 02:26:54

[TOC] ## 实例 ``` $it = new RecursiveArrayIterator(array(1, 2, array(3, 4, array(5, 6, 7), 8), 9, 10)); $iter = new RecursiveTreeIterator($it); foreach ($iter as $k=>$v){ // 通过 替换 |-,Array,|,\- 可以进行自定义组合 echo $v.PHP_EOL; } //|-1 //|-2 //|-Array //| |-3 //| |-4 //| |-Array //| | |-5 //| | |-6 //| | \-7 //| \-8 //|-9 //\-10 ```
';