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

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

《L03 构架 API 服务器》
你将学到如 RESTFul 设计风格、PostMan 的使用、OAuth 流程,JWT 概念及使用 和 API 开发相关的进阶知识。
《L02 从零构建论坛系统》
以构建论坛项目 LaraBBS 为线索,展开对 Laravel 框架的全面学习。应用程序架构思路贴近 Laravel 框架的设计哲学。
KayuHo
最佳答案

@1099446868 路由文件贴出来看看

6年前 评论
讨论数量: 6
KayuHo

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

6年前 评论

@Joy_he 我的表单:


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

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

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

6年前 评论
KayuHo

@1099446868 路由文件贴出来看看

6年前 评论

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

6年前 评论

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

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

5年前 评论

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