VerifyCsrfToken.php 第 68 行中的 TokenMismatchException:Laravel 5.4

TokenMismatchException in VerifyCsrfToken.php line 68: Laravel 5.4

发送post请求时发送查询post时发生错误
VerifyCsrfToken.php 第 68 行中的 TokenMismatchException

1
2
3
4
5
     <form action ="contact" method ="POST">
         Name <input type ="text" name ="param">
         Текст <textarea name ="" id ="" cols ="30" rows ="10></textarea>
          <input type="
submit" value ="submit">
     </form>

相关讨论

  • 确保您将 csrf 令牌添加到您的表单中。 laravel.com/docs/5.4/csrf
  • 不,它也不起作用
  • 如果没有更多的代码,我们就无能为力了。
  • <form action="contact" method="POST"> 名称 <input type="text" name="param"> 文本 <textarea name=" 30" rows="10"></textarea> <!--<input type="hidden" name="_method" value="post">--> <input type= "提交" 值="提交"> </form>
  • 将代码添加到您的帖子中使其更易于阅读,并且我在那里看不到 csrf 令牌。
  • VerifyCsrfToken.php 第 68 行中 Laravel 5.4 TokenMismatchException 的可能重复项

你的问题是你没有为 csrf 发送令牌,在 laravel 中为这个特殊方法 {{csrf_field()}} 提供
你可以在这里详细阅读 laravel csrf

1
2
3
4
5
6
<form action ="contact" method ="POST">
     {{csrf_field()}}
     Name <input type ="text" name ="param">
     Текст <textarea name ="" id ="" cols ="30" rows ="10></textarea>
      <input type="
submit" value ="submit">
 </form>

尝试在表单中添加 {{ csrf_field() }}

1
2
3
4
5
<form>
  {{ csrf_field() }}
  <input >
  ...
</form>

这将为您插入 csrf 令牌的隐藏字段


以上是VerifyCsrfToken.php 第 68 行中的 TokenMismatchException:Laravel 5.4的全部内容。
THE END
分享
二维码
< <上一篇
下一篇>>