Yii 2.0 如何判断当前请求的页面是不是 404?
main.php配置如下:
'components' => [ 'errorHandler' => [ 'errorAction' => 'site/error', ], ] public function actionError() { $errorCode = Yii::$app->response->getStatusCode(); if($errorCode == 404){ //... } }