提交表格时,以下路线工作正常
Route::put('/autorisation', 'AdministratifController@update_autorisation')->name('administartif.updateautorisation');
但我想知道为什么当我试图访问 http://example.com/autorisation
它抛出
Symfony \ Component \ HttpKernel \ Exception \ MethodNotAllowedHttpException
No message
找不到页面
它's not about the form it' s关于进入浏览器并键入 example.com/autorisation
然后你得到 no message
的错误代替404
PS:在我的路线中我没有定义这个 Route::get('/autorisation')
4 回答
您将路线定义为
PUT
,但您尝试使用它像GET
路线 . 这就是你得到MethodNotAllowed
的原因 .如果你想显示404错误而不是这个MethodNotAllowed(当
DEBUG=false
时它会是一个Whoops)你应该在你的处理程序中处理它 .在
App\Exceptions\Handler
编辑report
方法如下所示:请改变你的路线,试试这个:
通过自己访问页面,您可以执行GET HTTP请求而不是PUT .
您需要将路由设置为GET而不是PUT .