循环递归-数组,循环递归数组
循环递归-数组,循环递归数组
private function Fndotoarea($oid){
$oid = $this->CHTID($oid);
$arrtaff = array();
$arrt =array();
$arrr = array();
foreach($this->select("SELECT areaname , tid FROM otoarea WHERE oid = '".$oid."' " ) as $ks){
$arrr= Array("node"=>$ks["areaname"],"value"=>$ks["tid"]);
foreach ($this->select("select areaname , tid FROM otoarea WHERE oid = '".$ks["tid"]."' ") as $kr){
$arrr['nodes'][] = Array("node"=>$kr["areaname"],"value"=>$kr["tid"]);
}
$nodes = $this->Fndotoarea($ks["tid"]);
if(!empty($nodes)){
$arrr["nodes"] = $nodes;
}
array_push($arrtaff, $arrr);
}
return $arrtaff;
}
/*-------------------------------------------------------------*/
private function Fndotoarea($oid){
$oid = $this->CHTID($oid);
$arrtaff = array();
$arrt =array();
$arrr = array();
foreach($this->select("SELECT areaname , tid FROM otoarea WHERE oid = '".$oid."' " ) as $ks){
$arrr= Array("node"=>$ks["areaname"],"value"=>$ks["tid"]);
foreach ($this->select("select areaname , tid FROM otoarea WHERE oid = '".$ks["tid"]."' ") as $kr){
$arrr['nodes'][] = Array("node"=>$kr["areaname"],"value"=>$kr["tid"]);
}
$nodes = $this->Fndotoarea($ks["tid"]);
if(!empty($nodes)){
$arrr["nodes"] = $nodes;
}
array_push($arrtaff, $arrr);
}
return $arrtaff;
}