2 回答
TA贡献1796条经验 获得超4个赞
public function getCatalogList($$$$id=0,$$$$level=0){$$$$conditions = array('cg_fid'=>$$$$id);$$$$results = $$$$this->findAll($$$$conditions,"cg_px ASC");$$$$catlist = array();for($$$$i=0;$$$$i < $$$$level *2 - 1;$$$$i++){$$$$str .=" ";}if($$$$level++){$$$$str .= "├ ";};foreach ($$$$results as $$$$cat){$$$$id = $$$$cat['cg_id'];$$$$tj = $$$$cat['cg_tj'];$$$$child = $$$$cat['cg_child'];$$$$num = $$$$cat['cg_num'];$$$$name = $$$$str.$$$$cat['cg_name'];$$$$paixu = $$$$cat['cg_px'];$$$$value = array('cg_id'=>$$$$id,'cg_name'=>$$$$name,'cg_px'=>$$$$paixu,'cg_num'=>$$$$num,'cg_child'=>$$$$child,'cg_tj'=>$$$$tj,);$$$$catlist[] = $$$$value;$$$$catlist = array_merge($$$$catlist,$$$$this->getCatalogList($$$$id,$$$$level));}return $$$$catlist;} 上次论坛搜索到的,就可以用的
添加回答
举报