/** * (void) actionTreenode : 生成目录树 * @param string $unitcode */ public function actionTree($id = 1) { $model = new Menu(); if ($id == '#') { $id = 1; } $data = $model->getChildren($id); //VarDumper::dump($data); Yii::$app->response->format = Response::FORMAT_JSON; echo json_encode($data); }