时间:2021-07-01 10:21:17 帮助过:19人阅读
数据库是dedecms默认的,dede_arctype是保存栏目的表,reid是栏目的父级栏目id。
代码如下:
$array = array();
get_sons($type, $array);
var_dump($array);
function get_sons($type, &$current_array){
$result = mysql_query("select id from dede_arctype where reid = {$type}");
while($row = mysql_fetch_assoc($result)){
$current_array[] = $row['id'];
get_sons($row['id'], $current_array);
}
}