12345678910111213141516171819202122232425262728293031323334353637383940414243 |
- <?php
- namespace app\controllers;
- use Yii;
- use \app\common\controllers\CController;
- class AlertController extends CController
- {
- public function actionError()
- {
- $exception = Yii::$app->errorHandler->exception;
- if ($exception !== null) {
- if($exception->getCode()==404)
- {
- return $this->renderPartial('lost');
- }
- else
- {
- $code = $exception->getCode()?$exception->getCode():'500';
- $data = [
- 'code' => $code,
- 'message' => $exception->getMessage(),
- 'file' => $exception->getFile(),
- 'line' => $exception->getLine(),
- 'lastnum'=>substr($code,2,1),
- 'homeurl'=>APP_URL
- ];
- if(defined('IN_ADMIN')&&IN_ADMIN==true)
- {
- $data['homeurl'] = $this->adminHomeUrl;
- }
- return $this->renderPartial('error', $data);
- }
- }
- }
- }
|