| 1234567891011121314151617181920212223242526272829303132 |
- <?php
- namespace frontend\controllers;
- use Yii;
- use yii\web\Controller;
- class SiteController extends BaseController
- {
- public function actionIndex()
- {
- return $this->render('index');
- }
- /**
- * 错误处理器
- * @return string|\yii\web\Response
- */
- public function actionError()
- {
- $handler = Yii::$app->getErrorHandler();
- $exception = $handler->exception;
- if ($exception == null) {
- // 没有异常
- $exception = new NotFoundHttpException();
- }
- $response = Yii::$app->getResponse();
- $response->setStatusCodeByException($exception);
- return $this->renderPartial('/site/error404.php');
- }
-
- }
|