【发布时间】:2019-08-19 09:23:00
【问题描述】:
我需要为某些引用者禁用 csrf 令牌。我该怎么做?
我试过了:
/**
* The URIs that should be excluded from CSRF verification.
*
* @var array
*/
protected $except = [
$_SERVER['HTTP_REFERER'] == 'http://example.com' ? '/example' : '',
];
但我得到错误:expression is not allowed as field default value
【问题讨论】:
-
您不能在类定义中使用表达式。它必须是一个静态值。相反,在 __construct 方法中分配它