Thinkphp 獲取所有子分類或父分類ID

2021-09-08 18:47:06 字數 1547 閱讀 7019

/**

* @author: htl

* @email: [email protected]

* @datetime: 2016-04-22 11:25:02

* @description: 獲取當前分類下所有子類id

* @pid:父類id

*/function get_child_ids($pid)

/*** @author: htl

* @email: [email protected]

* @datetime: 2016-04-22 11:25:02

* @description: 獲取當前分類下所有父類id

* @id:子類id

*/function get_parent_ids($id)

/*** @author: htl

* @email: [email protected]

* @datetime: 2016-04-22 11:25:02

* @description: 獲取類下所有父/子類id

* @pid:多個父/子類id集以,分隔

* @childids:找到的子/父分類列表

* @find_column:where查詢的字段[id|pid:default]

*/function __get_ids($pid,$childids,$find_column = 'id')

/*** @author: htl

* @email: [email protected]

* @datetime: 2016-04-07 09:33:27

* @description: 預設狀態更改

*/function is_default()

else

print_r($id);exit;

$rst = $this->model->where("id in($id)")->setfield('is_default',$type);

if ($rst) else

} else

}

create table `thk_material` (

`id` int(11) not null auto_increment comment '自增id',

`pid` int(11) null default '0' comment '父類id'

來自為知筆記(wiz)

php 所有子類,php獲取分類以下的全部子類方法

獲取分類以下的全部子類方法 static function getmenutree arrcat,parent id 0,level 0,all true static arrtree 使用static取代global if all arrtree if empty arrcat return fa...

儲存過程獲取子分類id

if exists select from dbo.sysobjects where id object id n dbo trades and objectproperty id,n isusertable 1 drop table dbo trades gocreate table dbo tr...

thinkphp無限遞迴查詢分類

遍歷父id下所有資料 function getson parent id 0,t 1 return temp if session uid 1 if empty data return temp 看上面的while迴圈,當while迴圈完成以後,告訴我 data這個二維陣列裡面存的是什麼?當然是乙個...