laravel-CSRF令牌始终会更改 [英] laravel - CSRF token always changes
问题描述
这是我从昨天开始面临的问题.它总是给我TokenMismatchException
,当我深入研究并比较一些东西时,我发现在我的本地服务器上,_token
字段永远不会改变.但是在我的作品中,确实如此.这就是它一直给我TokenMismatchException
的原因.有人知道如何解决此错误.
Well this is the problem I am facing from yesterday. It is always giving me TokenMismatchException
and when I digged in and compared a few things, I found that on my local server, the _token
field never changes. But on my production, it does. And that's the reason it kept giving me TokenMismatchException
. Does anyone know how to fix this error.
我有
- 见过这个问题
- 浏览了文档.
- 编写了一些代码接受测试.
-
<input id="token" type="hidden" value="{{ csrf_token() }}">
这已经在我的代码中了.
- seen this question
- Went through documentation.
- Wrote several codeception tests.
<input id="token" type="hidden" value="{{ csrf_token() }}">
this already in my code.
推荐答案
检查config/session.php
设置中是否有domain
到正确的路径.甚至我也遇到了同样的问题.只需更改该路径即可解决该问题.
Check if you have domain
in the config/session.php
setup to the right path. Even I had got the same problem. And resolved it just by changing that path.
这篇关于laravel-CSRF令牌始终会更改的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!