您好关于speedphp 多级分类,树枝型。该怎么编写函数?求助大佬们

求助speedphp 多级分类,树枝型。该怎么编写函数

侃侃无极
浏览 216回答 2
2回答

SMILET

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;} 上次论坛搜索到的,就可以用的

噜噜哒

应该是目录的结构,miniui上面有tree控件,直接把id name pid的数据取出来绑到控件上就可以了
打开App,查看更多内容
随时随地看视频慕课网APP