public function index() { //调用生成菜单函数 $info = getInto(); $this->info = $info; $this->display(); }
function getInto($pid = 0, &$result = array()) { $system = M('System'); $info = $system->where(array('status' => 1, 'pid' => $pid))->select(); foreach ($info as $key => $val) { $result[$val['id']] = $val; getInto($val['id'], $result[$val['id']][]); } return $result; }