Home > Backend Development > PHP Tutorial > 实现了无限分类,但是想要显示呈现树状图,该怎么处理

实现了无限分类,但是想要显示呈现树状图,该怎么处理

WBOY
Release: 2016-06-13 13:39:43
Original
783 people have browsed it

实现了无限分类,但是想要显示呈现树状图
如根目录
  |____大类1
  | |―小类1
  | |―小类2
  |____大类2
 无限分类我用递归法已经实现了,但是想要在选择框内这样显示出来应该怎么办?

------解决方案--------------------
这种东西网上很多的,找找一大堆

http://www.oschina.net/code/snippet_99943_1452
------解决方案--------------------

PHP code

foreach($result as $res){
  foreach($$res as $r){
    if($r['id'] == $res['id'])
      echo "| |- 小".$r['id']."<br>";
  }
  echo "| - - 大".$r['id']."<br>";
}
<br><font color="#e78608">------解决方案--------------------</font><br>选择框显示是同样的道理。 嵌入select控件就是了。
<br><font color="#e78608">------解决方案--------------------</font><br>先给出你获得的数据(只要有代表性即可,无需完整数据) <div class="clear">
                 
              
              
        
            </div>
Copy after login
Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template