'beforeAction', ]; } /** * @param \yii\base\Action $e * @return bool|void * @throws ForbiddenHttpException */ public function beforeAction($e) { if (is_array($this->ignores) && in_array($e->id, $this->ignores)) { return true; } $isAdmin = \Yii::$app->session->get('__is_admin'); if (!$isAdmin) { throw new ForbiddenHttpException('非管理员禁止访问。'); return false; } return true; } }