outJson(1, [], 'test ok!'); } /** * 错误处理器 * @return \yii\web\Response */ public function actionError() { $errorHandler = Yii::$app->getErrorHandler(); $exception = $errorHandler->exception; if ($exception == null) { $exception = new NotFoundHttpException(); } Yii::$app->getResponse()->setStatusCodeByException($exception); return $this->outJson(0, [], Yii::$app->getResponse()->statusText); } }