如果在登录页面中使用,Auth :: logout()会出错(无需登录)。 Laravel 5.5

问题描述 投票:2回答:1

我正在使用laravel 5.5。我对Auth::logout()功能有点问题。这个函数工作正常,但如果我在登录页面(未记录用户)中使用此路径路径(手动编写),这将给出这样的错误。我该怎么做才能防止出现此错误消息?

enter image description here

php laravel authentication logout laravel-5.5
1个回答
4
投票

logout路由,默认情况下是POST路由,尝试通过键入地址来访问它会导致GET请求,这将是MethodNotAllowedHttpException。 (假设您通过Route::auth()注册了路线)

© www.soinside.com 2019 - 2024. All rights reserved.