Home > Backend Development > PHP Tutorial > thinkphp 分类问题

thinkphp 分类问题

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-20 12:42:17
Original
829 people have browsed it



点击上面的一级分类下面左侧数来二级分类怎么写啊


回复讨论(解决方案)

请参考:无限级分类算法。

	static public function findChilden($cate, $pid){		$arr = array();		foreach($cate as $v){			if($v['pid'] == $pid){				$arr[] = $v['id']; //返回所有子类id				//$arr[] = $v; //返回所有子类详细数据				$arr = array_merge($arr, self::findChilden($cate, $v['id']));			}		}		return $arr;	}
Copy after login

thinkphp并没有提供无限级分类的方法(onethink则有提供),你可以自己写个递归的函数,就像上面一样。

thinkphp并没有提供无限级分类的方法(onethink则有提供),你可以自己写个递归的函数,就像上面一样。

已经解决了,谢谢啊
Related labels:
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template