public function getCategoryTree($pid=0,$t=-1) { $t++; static $cat_temp; $data = M('keywords_categroy')->findAll(array('pid'=>$pid),'id ASC, category'); if(!empty($data)) { foreach ($data as $key => $val ) { $val['category'] = str_repeat(' ',$t*3).'├'.$val['category']; $val['level'] = $t+1; $cat_temp[] = $val; $this -> getCategoryTree($val['id'],$t); } } return $cat_temp; }