【问题标题】:TokenMismatchException in VerifyCsrfToken.php line 68: Laravel 5.4VerifyCsrfToken.php 第 68 行中的 TokenMismatchException:Laravel 5.4
【发布时间】:2017-04-14 14:31:38
【问题描述】:

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

     <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>

【问题讨论】:

标签: php laravel-5.4


【解决方案1】:

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

<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>

【讨论】:

    【解决方案2】:

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

    <form>
      {{ csrf_field() }}
      <input >
      ...
    </form>
    

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

    【讨论】:

      猜你喜欢
      • 2019-02-11
      • 2017-07-29
      • 1970-01-01
      • 2017-08-26
      • 2017-02-21
      • 2017-02-23
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多