当我尝试在默认登录中运行/ logout路径时,它会给我这个错误 我该怎么办?
in RouteCollection.php line 218
2.at RouteCollection->methodNotAllowed(array('POST')) in RouteCollection.php line 205
3.at RouteCollection->getRouteForMethods(object(Request), array('POST')) in RouteCollection.php line 158
4.at RouteCollection->match(object(Request)) in Router.php line 766
5.at Router->findRoute(object(Request)) in Router.php line 621
6.at Router->dispatchToRoute(object(Request)) in Router.php line 607
7.at Router->dispatch(object(Request)) in Kernel.php line 268
8.at Kernel->Illuminate\Foundation\Http\{closure}(object(Request)) in Pipeline.php line 53
9.at Pipeline->Illuminate\Routing\{closure}(object(Request)) in CheckForMaintenanceMode.php line 46
10.at CheckForMaintenanceMode->handle(object(Request), object(Closure)) in Pipeline.php line 137
11.at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in Pipeline.php line 33
12.at Pipeline->Illuminate\Routing\{closure}(object(Request)) in Pipeline.php line 104
13.at Pipeline->then(object(Closure)) in Kernel.php line 150
14.at Kernel->sendRequestThroughRouter(object(Request)) in Kernel.php line 117
15.at Kernel->handle(object(Request)) in index.php line 53
答案 0 :(得分:3)
laravel 5.3中的Auth :: routes方法为/ logout而不是GET路由注册POST路由。这可以防止其他Web应用程序将您的用户从您的应用程序中删除。要进行升级,您应该将您的注销请求转换为使用POST动词,或者只是通过将此路由添加到文件Routes / web.php来为/ logout URI注册您自己的GET路由: - Route :: get('/ logout','Auth \ LoginController @ logout');
它应该可以正常工作并将您重定向到'/'目录,因为它在LoginController.php中定义
这是文档,我认为是第9段 https://laravel.com/docs/5.3/upgrade