function isHaveChildCategory($cid){
$m=M('goods_category');
$con['goodscategory_pid']=$cid;
$result=$m->where($con)->getField('goodscategory_id',true);
foreach($result as $key=>$value){
isHaveChildCategory($value);
}
return $result;
}
建议你下载ecshop的代码来看 说简单点他就是个树 当然像ecshop那样自己写代码用缩进拼出一个树来也是可以的