MessageController.php 561 B

12345678910111213141516171819202122232425262728293031
  1. <?php
  2. namespace api\controllers;
  3. use Yii;
  4. use yii\web\Controller;
  5. use yii\web\NotFoundHttpException;
  6. /**
  7. *
  8. * 报错消息处理
  9. *
  10. * Class MessageController
  11. * @package api\controllers
  12. * @author qimall
  13. */
  14. class MessageController extends Controller
  15. {
  16. /**
  17. * @return string
  18. */
  19. public function actionError()
  20. {
  21. if (($exception = Yii::$app->getErrorHandler()->exception) === null) {
  22. $exception = new NotFoundHttpException(Yii::t('yii', 'Page not found.'));
  23. }
  24. return $exception->getMessage();
  25. }
  26. }