Laravel中的csrf令牌失配异常

Laravel中的csrf令牌失配异常,laravel,csrf,Laravel,Csrf,我用Laravel创建了一个网店,一切都进行得很顺利,直到最近我才开始收到令牌不匹配异常。 用户可以毫无问题地登录。每当用户试图将商品添加到购物车时,就会出现此问题。我并没有真正改变页面上的任何内容,似乎这是它自己开始改变的。我对服务器所做的唯一一件事就是清除缓存。这会导致问题发生吗 我的所有控制器都以以下内容开头: public function __construct() { parent::__construct(); $this->beforeFilter('csr

我用Laravel创建了一个网店,一切都进行得很顺利,直到最近我才开始收到令牌不匹配异常。
用户可以毫无问题地登录。每当用户试图将商品添加到购物车时,就会出现此问题。我并没有真正改变页面上的任何内容,似乎这是它自己开始改变的。我对服务器所做的唯一一件事就是清除缓存。这会导致问题发生吗

我的所有控制器都以以下内容开头:

public function __construct() {
    parent::__construct();
    $this->beforeFilter('csrf', array('on'=>'post'));
}
我的会话配置设置如下:

/*
|--------------------------------------------------------------------------
| Default Session Driver
|--------------------------------------------------------------------------
|
| This option controls the default session "driver" that will be used on
| requests. By default, we will use the lightweight native driver but
| you may specify any of the other wonderful drivers provided here.
|
| Supported: "file", "cookie", "database", "apc",
|            "memcached", "redis", "array"
|
*/

'driver' => 'file',

/*
|--------------------------------------------------------------------------
| Session Lifetime
|--------------------------------------------------------------------------
|
| Here you may specify the number of minutes that you wish the session
| to be allowed to remain idle before it expires. If you want them
| to immediately expire on the browser closing, set that option.
|
*/

'lifetime' => 15,

'expire_on_close' => false,  
我使用的csrf滤波器是否错误?我似乎找不到解决这个问题的办法

-编辑-

我尝试从控制器上取下我的csrf过滤器,现在用户在向购物车添加项目时自动注销(我想这就是问题所在)。

在我的视图中,我使用{{Form::token().Form::close()}}关闭表单。这还不够吗?@SimonOlsen如果您使用
Form::open
Form::close
则无需使用
Form::token
手动指定令牌@AndréDaniel谢谢。这是我添加的东西,看看它是否能解决问题。最初,我只使用Form::open和Form::close(尽管仍然存在问题)。使用浏览器的开发人员工具查看向购物车添加内容时发出的请求,查看是否存在CSRF令牌。