php+mysql查询实现无限下级分类树输出实例

2023-05-2818:06:23后端程序开发Comments1,310 views字数 3686阅读模式

实例讲述了php+mysql查询实现无限下级分类树输出。分享给大家供大家参考,具体如下:文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

这里介绍的php结合mysql查询无限下级树输出,其实就是无限分类,给各位整理了几个php无限分类的例子.文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

树输出:文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

function get_array($user_id,$top=0){文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

global $mysql,$_G;文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

$sql = "select user_id as name from `{spreads_users}`  where p1.spreads_userid='{$user_id}'";文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

$rows$mysql->db_fetch_arrays($sql);文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

if($top==1){文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

$arr[0]['name']=$user_id;文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

$arr[0]['children']=array();文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

}文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

$top=$top+1;文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

foreach ($rows as $key=>$value)文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

{文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

$r = get_array($value['name']); //调用函数,传入参数,继续查询下级文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

$arr[0]['children'][$key]['name']= $value['username']; //组合数组文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

if(is_array($r)){文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

$arr[0]['children'][$key]['children']= $r[0]['children'];文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

}文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

$i++;文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

}文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

return $arr;文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

}文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

$list = get_array("1000",1); //调用函数1000是顶级ID文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

echo 'var data='.json_encode($list);文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

这个是输出 Array 然后转让为 json文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

例子:文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

表结构:id字段为分类标识,name字段为分类名,father_id字段为所属父分类的id,path字段为分类路径,储存该分类祖先的集合,isdir判断是否是目录,1为是,0为否.文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

显示函数:文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

//$count为分类等级文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

sort_list($str,$fatherid,$count)文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

{文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

$rs = $this->sql->re_datas("select * from sort where father_id = fatherid");文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

$num = $this->sql->sql_numrows();文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

$i=0;文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

$n = 1;文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

while(isset($rs[$i]))文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

{文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

$name = "";文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

for($n = 1 ; $n < $count ; $n )文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

{文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

$name.="│ ";文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

}文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

if($i 1==$num)文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

{文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

$name.="└─".$rs[$i][name];文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

}文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

else文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

{文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

$name.="├─".$rs[$i][name];文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

}文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

if($rs[$i][isdir])文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

{文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

$str.="<span style='color:#CCCCCC'>".$name."</span>";文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

}文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

else文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

{文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

$str.=$name";文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

}文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

$temp = $count 1;文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

$str = $this->sort_list($str,$rs[$i][id],$temp);文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

$i ;文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

}文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

return $str;文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

}文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

其中$this->sql对象为sql操作类对象,re_datas()函数返回查到的数组,sql_numrows()函数返回查询到的数目.文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

调用方法:文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

$sort_list = sort_list($sort_list,0,1);文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

例子:文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

表:category文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

id int 主键,自增文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

name varchar 分类名称文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

pid int 父类id,默认0文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

顶级分类的 pid 默认就是0了,当我们想取出某个分类的子分类树的时候,基本思路就是递归,当然,出于效率问题不建议每次递归都查询数据库,通常的做法是先讲所有分类取出来,保存到PHP数组里,再进行处理,最后还可以将结果缓存起来以提高下次请求的效率.文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

先来构建一个原始数组,这个直接从数据库中拉出来就行:文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

$categories = array(文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

array('id'=>1,'name'=>'电脑','pid'=>0),文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

array('id'=>2,'name'=>'手机','pid'=>0),文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

array('id'=>3,'name'=>'笔记本','pid'=>1),文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

array('id'=>4,'name'=>'台式机','pid'=>1),文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

array('id'=>5,'name'=>'智能机','pid'=>2),文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

array('id'=>6,'name'=>'功能机','pid'=>2),文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

array('id'=>7,'name'=>'超级本','pid'=>3),文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

array('id'=>8,'name'=>'游戏本','pid'=>3),文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

);文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

目标是将它转化为下面这种结构:文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

  1. 电脑
  2. —笔记本
  3. ——-超级本
  4. ——-游戏本
  5. —台式机
  6. 手机
  7. —智能机
  8. —功能机

用数组来表示的话,可以增加一个 children 键来存储它的子分类:文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

array(文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

//1对应id,方便直接读取文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

1 => array(文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

'id'=>1,文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

'name'=>'电脑',文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

'pid'=>0,文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

children=>array(文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

&array(文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

'id'=>3,文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

'name'=>'笔记本',文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

'pid'=>1,文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

'children'=>array(文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

//此处省略文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

)文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

),文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

&array(文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

'id'=>4,文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

'name'=>'台式机',文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

'pid'=>1,文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

'children'=>array(文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

//此处省略文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

)文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

),文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

)文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

),文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

//其他分类省略文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

)文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

处理过程:文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

$tree = array();文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

//第一步,将分类id作为数组key,并创建children单元文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

foreach($categories as $category){文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

$tree[$category['id']] = $category;文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

$tree[$category['id']]['children'] = array();文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

}文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

//第二部,利用引用,将每个分类添加到父类children数组中,这样一次遍历即可形成树形结构。文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

foreach ($tree as $k=>$item) {文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

if ($item['pid'] != 0) {文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

$tree[$item['pid']]['children'][] = &$tree[$k];文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

}文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

}文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

print_r($tree);打印结果如下:文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

Array文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

(文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

[1] => Array文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

(文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

[id] => 1文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

[name] => 电脑文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

[pid] => 0文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

[children] => Array文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

(文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

[0] => Array文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

(文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

[id] => 3文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

[name] => 笔记本文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

[pid] => 1文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

[children] => Array文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

(文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

[0] => Array文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

(文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

[id] => 7文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

[name] => 超级本文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

[pid] => 3文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

[children] => Array文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

(文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

)文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

)文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

[1] => Array文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

(文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

[id] => 8文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

[name] => 游戏本文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

[pid] => 3文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

[children] => Array文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

(文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

)文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

)文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

)文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

)文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

[1] => Array文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

(文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

[id] => 4文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

[name] => 台式机文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

[pid] => 1文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

[children] => Array文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

(文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

)文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

)文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

)文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

)文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

[2] => Array文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

(文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

[id] => 2文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

[name] => 手机文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

[pid] => 0文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

[children] => Array文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

(文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

[0] => Array文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

(文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

[id] => 5文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

[name] => 智能机文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

[pid] => 2文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

[children] => Array文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

(文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

)文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

)文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

[1] => Array文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

(文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

[id] => 6文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

[name] => 功能机文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

[pid] => 2文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

[children] => Array文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

(文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

)文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

)文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

)文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

)文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

[3] => Array文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

(文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

[id] => 3文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

[name] => 笔记本文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

[pid] => 1文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

[children] => Array文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

(文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

[0] => Array文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

(文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

[id] => 7文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

[name] => 超级本文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

[pid] => 3文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

[children] => Array文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

(文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

)文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

)文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

[1] => Array文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

(文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

[id] => 8文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

[name] => 游戏本文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

[pid] => 3文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

[children] => Array文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

(文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

)文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

)文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

)文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

)文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

[4] => Array文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

(文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

[id] => 4文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

[name] => 台式机文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

[pid] => 1文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

[children] => Array文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

(文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

)文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

)文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

[5] => Array文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

(文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

[id] => 5文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

[name] => 智能机文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

[pid] => 2文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

[children] => Array文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

(文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

)文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

)文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

[6] => Array文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

(文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

[id] => 6文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

[name] => 功能机文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

[pid] => 2文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

[children] => Array文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

(文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

)文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

)文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

[7] => Array文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

(文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

[id] => 7文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

[name] => 超级本文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

[pid] => 3文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

[children] => Array文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

(文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

)文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

)文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

[8] => Array文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

(文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

[id] => 8文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

[name] => 游戏本文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

[pid] => 3文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

[children] => Array文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

(文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

)文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

)文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

)文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

优点:关系清楚,修改上下级关系简单.文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

缺点:使用PHP处理,如果分类数量庞大,效率也会降低.文章源自菜鸟学院-https://www.cainiaoxueyuan.com/bc/42929.html

  • 本站内容整理自互联网,仅提供信息存储空间服务,以方便学习之用。如对文章、图片、字体等版权有疑问,请在下方留言,管理员看到后,将第一时间进行处理。
  • 转载请务必保留本文链接:https://www.cainiaoxueyuan.com/bc/42929.html

Comment

匿名网友 填写信息

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定