Skip to content

Commit

Permalink
Cookie security /Cookie 安全
Browse files Browse the repository at this point in the history
  • Loading branch information
star7th committed Nov 22, 2021
1 parent a9886f2 commit 654e871
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions server/index.php
Expand Up @@ -8,6 +8,18 @@
require './vendor/autoload.php';
}

// cookie安全,给PHPSESSID加上Strict
if (PHP_VERSION_ID >= 70300) {
session_set_cookie_params([
'samesite' => 'Strict'
]);
} else {
session_set_cookie_params(
NULL,
'/; samesite=Strict',
);
}

// 开启调试模式 建议开发阶段开启 部署阶段注释或者设为false
define('APP_DEBUG',True);

Expand Down

0 comments on commit 654e871

Please sign in to comment.