双轨是营销的一种模式,主要就是下级的数量最多只有两个。

主要是使用了jq的一个插件,看效果图

php 双轨模式无限级划分

这是数据的结构

php 双轨模式无限级划分

插件地址 http://www.jq22.com/jquery-info4494

配合上php的无限级分类 把数据组合成对应的结构

function getTree($data, $pId)
     {
     $html = '';
     foreach($data as $k => $v)
     {
        if($v['fid'] == $pId)
        {
         $html .= "<li>".$v['cardnum'];
         $html .= $this->getTree($data, $v['cid']);
         $html = $html."</li>";
        }
     }
     return $html ? '<ul>'.$html.'</ul>' : $html ;
     }

这就完成了

php 双轨模式无限级划分

相关文章:

  • 2022-02-20
  • 2022-12-23
  • 2021-11-22
  • 2022-12-23
  • 2022-12-23
  • 2021-11-03
  • 2021-06-30
猜你喜欢
  • 2021-10-21
  • 2021-07-20
  • 2022-12-23
  • 2021-11-14
  • 2021-11-14
  • 2021-11-22
相关资源
相似解决方案