请问我点了退出后报错是怎么回事?

点了退出后,报Symfony \ Component \ HttpKernel \ Exception \ MethodNotAllowedHttpException
No message 这个错误,控制台Status Code:405 Method Not Allowed

《L03 构架 API 服务器》
你将学到如 RESTFul 设计风格、PostMan 的使用、OAuth 流程,JWT 概念及使用 和 API 开发相关的进阶知识。
《G01 Go 实战入门》
从零开始带你一步步开发一个 Go 博客项目,让你在最短的时间内学会使用 Go 进行编码。项目结构很大程度上参考了 Laravel。
KayuHo
最佳答案

@1099446868 路由文件贴出来看看

6年前 评论
讨论数量: 6

我的错误 =》Route::get('/logout', 'SessionController@destroy')->name('logout');

正确的 =》 Route::delete('/logout', 'SessionController@destroy')->name('logout');

5年前 评论
KayuHo

@1099446868 路由文件贴出来看看

6年前 评论

非常感谢,我的退出的路由写错了,delete写成post了 Route::delete('logout', 'SessionsController@destroy')->name('logout');

6年前 评论
KayuHo

看下 form 表单中有没有指定 _methoddelete

6年前 评论

@Joy_he 我的表单:


{{ csrf_field() }}
{{ method_field('DELETE') }} 退出

                                    </form>,然后在源码中确实能看到_method的隐藏域,值为DELETE
6年前 评论

@Joy_he 然后在源码中能看到 _method 的隐藏域值为 DELETE

6年前 评论

讨论应以学习和精进为目的。请勿发布不友善或者负能量的内容,与人为善,比聪明更重要!