php FLEA中二叉树数组的遍历输出

前端之家收集整理的这篇文章主要介绍了php FLEA中二叉树数组的遍历输出前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

但是要怎样遍历这个方法产生的二叉树数组呢?以下是我的做法: <div class="codetitle"><a style="CURSOR: pointer" data="33753" class="copybut" id="copybut33753" onclick="doCopy('code33753')"> 代码如下:

<div class="codebody" id="code33753">
<?PHP
function preTree($cat){
foreach ($cat as $c){
?>

<a href="http://<?=$c['poper_site']?>"><?=$c['poper']?>:<?=t($c['content'])?>

<?php if(isset($c['childrens'])){?>

    <?php foreach ($c['childrens'] as $s){?>
  • <a href="http://<?=$s['poper_site']?>"><?=$s['poper']?>:<?=t($s['content'])?>


    <?PHP
    if(isset($s['childrens'])){
    ?>
    • <?PHP
      $this->preTree($s['childrens']);
      ?>
    <?PHP
    }
    ?>

  • <?php }?>

<?php }?>
<?PHP
}
}
?>

原文链接:https://www.f2er.com/php/26964.html

猜你在找的PHP相关文章