问题描述
我在哪里可以在 Laravel 5+ 中捕获 MethodNotAllowedHttpException?
Where can I catch a MethodNotAllowedHttpException in Laravel 5+?
在 Laravel 4 中,我可以在 start/global.php 中做到这一点.
In Laravel 4 I was able to do this in start/global.php.
推荐答案
// Exceptions/Handler.php use SymfonyComponentHttpKernelExceptionMethodNotAllowedHttpException; public function render($request, Exception $e) { if ($e instanceof MethodNotAllowedHttpException) { // … } return parent::render($request, $e); }