现在 setcookie Header 里面多了一个 SameSite,但 php 里的 setcookie 怎么设置这个值呢?
1
qiayue 2019-11-30 13:44:47 +08:00
|
2
littleylv 2019-11-30 13:48:08 +08:00
|
3
7DLNU56W OP 是说开始支持了,但没说怎么用啊,在最上面使用的语法那里,根本没有 SameSite 选项。
|
4
littleylv 2019-11-30 16:29:34 +08:00 1
@7DLNU56W #2 你不会浏览器 control+F 搜索一下“ SameSite”?
setcookie ( string $name [, string $value = "" [, int $expires = 0 [, string $path = "" [, string $domain = "" [, bool $secure = FALSE [, bool $httponly = FALSE ]]]]]] ) : bool setcookie ( string $name [, string $value = "" [, array $options = [] ]] ) : bool options An associative array which may have any of the keys expires, path, domain, secure, httponly and samesite. The values have the same meaning as described for the parameters with the same name. The value of the samesite element should be either Lax or Strict. If any of the allowed options are not given, their default values are the same as the default values of the explicit parameters. If the samesite element is omitted, no SameSite cookie attribute is set. 那当然是 setcookie('key', 'val', [ 'domain' => 'xx', 'expires' => 'yy', 'samesite' => 'Lax', ]); |