Skip to content

Commit 654e871

Browse files
committed
Cookie security /Cookie 安全
1 parent a9886f2 commit 654e871

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

Diff for: server/index.php

+12
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,18 @@
88
require './vendor/autoload.php';
99
}
1010

11+
// cookie安全,给PHPSESSID加上Strict
12+
if (PHP_VERSION_ID >= 70300) {
13+
session_set_cookie_params([
14+
'samesite' => 'Strict'
15+
]);
16+
} else {
17+
session_set_cookie_params(
18+
NULL,
19+
'/; samesite=Strict',
20+
);
21+
}
22+
1123
// 开启调试模式 建议开发阶段开启 部署阶段注释或者设为false
1224
define('APP_DEBUG',True);
1325

0 commit comments

Comments
 (0)