MessageController.php 580 B

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