**
* 建立父節點樹形陣列
* 引數
* $ar 陣列,鄰接列表方式組織的資料
* $id 陣列中作為主鍵的下標或關聯鍵名
* $pid 陣列中作為父鍵的下標或關聯鍵名
* 返回 多維陣列
**/function find_parent($ar, $id='id', $pid='pid')
} return $t;}
/*** 建立子節點樹形陣列
* 引數
* $ar 陣列,鄰接列表方式組織的資料
* $id 陣列中作為主鍵的下標或關聯鍵名
* $pid 陣列中作為父鍵的下標或關聯鍵名
* 返回 多維陣列
**/function find_child($ar, $id='id', $pid='pid')
}return $t;}
示例php code
$data = array(
array('id'=>1, 'parent'=>0, 'name'=>'祖父'),
array('id'=>2, 'parent'=>1, 'name'=>'父親'),
array('id'=>3, 'parent'=>1, 'name'=>'叔伯'),
array('id'=>4, 'parent'=>2, 'name'=>'自己'),
array('id'=>5, 'parent'=>4, 'name'=>'兒子'),);
$p = find_parent($data, 'id', 'parent');
$c = find_child($data, 'id', 'parent');
建立執行緒的兩種方法
有兩種方式 從tread中派生出新的子類 實現runnable介面 還有一種習慣用法 一 從tread中派生出新的子類 建立片段 給執行緒起名 a,並建立 new 型別 執行緒名字 start 完整的建立乙個執行緒,並呼叫 為了給執行緒起名字,建立了域name,並類裡邊建立了構造器 public c...
AO建立IFeature的兩種方法
原文 ao建立ifeature的兩種方法 在arcgis resouce center中,esri介紹了兩種建立feature的方法 可以在本地的geodatabase和sde的featureclass 第一種是ifeatureclass.createfeature,在這種方法最後需要加上ifeat...
AO建立IFeature的兩種方法
原文 ao建立ifeature的兩種方法 在arcgis resouce center中,esri介紹了兩種建立feature的方法 可以在本地的geodatabase和sde的featureclass 第一種是ifeatureclass.createfeature,在這種方法最後需要加上ifeat...