MethodNotAllowedHttpException - 没有消息

时间:2017-11-22 21:36:16

标签: laravel

我有问题。登录,注册正在运行,但是当我想注销时,我收到此错误:MethodNotAllowedHttpException - No message

错误链接:http://gazeta1.nazwa.pl/mesiek/error.html

3 个答案:

答案 0 :(得分:1)

注销路由上不允许的方法可能意味着您通过get请求(正常/注销链接)调用/注销,而注销请求则通过post调用。

创建新项目时,这是默认laravel应用程序的注销代码段

<a href="{{ url('logout')}}" onclick="event.preventDefault();
document.getElementById('logout-form').submit();">
    <i class="icon-key"></i> Log Out 
</a>
<form id="logout-form" action="{{ url('/logout') }}" method="POST" style="display: none;">
    {{ csrf_field() }}
</form>

通过隐藏表单调用实际的注销,链接只是提交表单。

但我不确定,因为你的问题中没有包含任何代码或细节

答案 1 :(得分:0)

尝试设置.env文件集

DB_HOST=localhost

并运行

php artisan config:cache

您的CLI希望这对您有用:)

答案 2 :(得分:0)

当我使用get和post方法而不是彼此时,出现此错误。例如,使用post方法代替获取用户数据。