代码展示: 将Tree树类放入扩展目录 \extend\Tree\Tree.php //引入Tree use Tree\Tree //所有数据 $cate = Db::name('category')->where(['status'=>1])->order('listorder asc')->selected(); $tree = new Tree; //实例化 $tree->tree($sort); //调用tree方法 $tree->icon = array(' │ ', ' ├─ ', ' └─ '); //树结构字符串 $list=$tree->getArray(); //获取树结构
文件下载:Tree.zip