【问题标题】:Laravel tokenmismatch exceptionLaravel 令牌不匹配异常
【发布时间】:2016-12-06 04:47:52
【问题描述】:

每隔一段时间我就会收到一个令牌不匹配异常。我发送令牌,这样就不可能了。当我清除缓存并删除我的 cookie 时,它​​又被修复了。这可能是什么?

其他信息

当我缓存所有呈现的 html 以使网站能够离线时,它就开始发生了。

【问题讨论】:

  • 我认为问题是您的令牌在某些时间内过期。检查您的 cookie 存储时间限制

标签: laravel token csrf csrf-protection


【解决方案1】:

令牌不匹配异常表明您的会话已过期。

您可以正确处理此异常。看看this forum。

【讨论】:

  • 谢谢 =) 这很有帮助,我一定会实现的
【解决方案2】:

你可以在config/session.php中增加session的时间限制

/*
    |--------------------------------------------------------------------------
    | 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' => 30,

'expire_on_close' => true,

默认是 30 分钟..

【讨论】:

  • 试过这个,希望它有效。如果有效,将报告
猜你喜欢
  • 2017-10-24
  • 1970-01-01
  • 1970-01-01
  • 2014-03-30
  • 2017-05-27
  • 1970-01-01
  • 1970-01-01
  • 2017-10-28
相关资源
最近更新 更多