gpt4 book ai didi

php - Laravel 5.3 形式的 TokenMismatchException

转载 作者:行者123 更新时间:2023-12-04 12:49:12 25 4
gpt4 key购买 nike

我很惭愧问这个问题,因为这个问题已经被其他人问过很多次了,但是我自己找不到任何解决办法。

我正在使用 Laravel 5.3,我根据文档和其他 stackoverflow 主题创建了一个简单的表单。

在我的本地机器上一切正常。将我的项目放在服务器上后,在我提交表单后这个错误不断出现:

TokenMismatchException in VerifyCsrfToken.php line 68:

head 部分添加了 CSRF token :

<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() }}

每次我使用表单时, token 都会保存在 storage/framework/sessions/中。

请帮我解决这个问题,我已经工作了 15 个多小时,但到目前为止什么都没做。

最佳答案

我的 .env 文件中有不可见的 BOM 字符。

我在我的 notepad++ 中将它转换为 utf8-without-BOM,现在它可以工作了。

关于php - Laravel 5.3 形式的 TokenMismatchException,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41515262/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com