【发布时间】:2017-05-21 18:44:04
【问题描述】:
问这个问题我感到很惭愧,因为其他人已经问过很多次了,但是我找不到适合自己的解决方案。
我使用的是 Laravel 5.3,我根据文档和其他 stackoverflow 主题创建了一个简单的表单。
在我的本地机器上一切正常。将我的项目放在服务器上后,在我提交表单后,此错误不断出现:
TokenMismatchException in VerifyCsrfToken.php line 68:
在head 部分添加了 CSRF 令牌:
<head>
<meta name="csrf-token" content="{{ csrf_token() }}" />
</head>
表单还包含 csrf:
<form method="POST" action="/save_new_order">
{{ csrf_field() }}
<input type="text" name="web_name">
<textarea cols="30" rows="15" name="web_description"></textarea>
<input type="email" name="web_email">
<input type="submit" id="submitButton" value="WYŚLIJ" name="submit">
</form>
我也尝试过使用:
<input type="hidden" name="_token" value="{{ csrf_token() }}">
代替:
{{ csrf_field() }}
每次我使用表单时,令牌都会保存在 storage/framework/sessions/ 中。
请帮帮我,我已经工作了超过 15 个小时,到目前为止还没有。
【问题讨论】:
标签: php laravel laravel-5 csrf laravel-5.3