PHP获取栏目的所有子级和孙级栏目的ID号示例
代码如下:
//@获取子栏目ID号 private function sonCategoryIds($categoryID) { //@初始化栏目数组 $array[] = $categoryID; do { $ids = ''; $temp = $this->mysql->select('SELECT `id` FROM `pcb_article_category` WHERE `parentID` IN (' . $categoryID . ')'); foreach ($temp as $v) { $array[] = $v['id']; $ids .= ',' . $v['id']; } $ids = substr($ids, 1, strlen($ids)); $categoryID = $ids; } while (!empty($temp)); $ids = implode(',', $array); return $ids; }
相关推荐
flydoging 2020-02-24
meiseeny 2020-02-21
mmywcoco 2020-02-20
朴有天虹 2019-07-01
andyjiang 2012-09-06
稻草誓言 2014-03-05
HowardWood 2008-10-07
GeraldJones 2019-06-06
唐滚滚 2018-07-29
不断攀登的梦想 2012-08-01
lanluyug 2019-01-12
本本牛 2016-04-03
liuyanwuyu 2014-11-18
zhaojikun 2019-04-23