laravel-CSRF令牌始终会更改 [英] laravel - CSRF token always changes

查看:60
本文介绍了laravel-CSRF令牌始终会更改的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我从昨天开始面临的问题.它总是给我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.

我有

  1. 见过这个问题
  2. 浏览了文档.
  3. 编写了一些代码接受测试.
  4. <input id="token" type="hidden" value="{{ csrf_token() }}">这已经在我的代码中了.
  1. seen this question
  2. Went through documentation.
  3. Wrote several codeception tests.
  4. <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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆