我在路线文件中使用Route::delete()
方法。在我将应用程序移动到新服务器之前,我使用此方法没有任何问题,但现在我得到了MethodNotAllowedHttpException
。我使用该应用程序大约 6个月没有任何问题。但现在我在每个删除过程中得到这个。当然,当我将方法更改为post
并添加隐藏的var _method
时,它可以正常工作。但我想知道(新设置)可能会在新服务器上造成这种情况。有什么想法吗?
例外情况:
MethodNotAllowedHttpException in RouteCollection.php line 218:
in RouteCollection.php line 218
at RouteCollection->methodNotAllowed(array('DELETE')) in RouteCollection.php line 205
at RouteCollection->getRouteForMethods(object(Request), array('DELETE')) in RouteCollection.php line 158
at RouteCollection->match(object(Request)) in Router.php line 821
at Router->findRoute(object(Request)) in Router.php line 691
at Router->dispatchToRoute(object(Request)) in Router.php line 675
at Router->dispatch(object(Request)) in Kernel.php line 246
at Kernel->Illuminate\Foundation\Http\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 52
at Pipeline->Illuminate\Routing\{closure}(object(Request)) in CheckForMaintenanceMode.php line 44
at CheckForMaintenanceMode->handle(object(Request), object(Closure))
at call_user_func_array(array(object(CheckForMaintenanceMode), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 136
at Pipeline->Illuminate\Pipeline\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 32
at Pipeline->Illuminate\Routing\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 103
at Pipeline->then(object(Closure)) in Kernel.php line 132
at Kernel->sendRequestThroughRouter(object(Request)) in Kernel.php line 99
at Kernel->handle(object(Request)) in index.php line 5
答案 0 :(得分:1)
MethodNotAllowedHttpException
表示找不到您的http请求的路由。
答案 1 :(得分:1)
methodNotAllowed异常表示您请求的HTTP方法不存在路由。
路由::删除示例:
Route::delete('empresas/eliminar/{id}', [
'as' => 'companiesDelete',
'uses' => 'CompaniesController@delete'
]);