我正在努力在 php 7.3 中升级我的域,但是当我这样做时,我的 quiz.php 文件之一不起作用,它说:
无法启动安全会话 (ini_set)。
我提到它在 7.1 中运行良好,所以我认为问题出在函数 sec_session 中的 function.php 文件上。我将向您展示代码,与 7.1 相比没有任何更改。
<?php
include_once 'psl-config.php';
function sec_session_start() {
$session_name = 'sec_session_id'; // Set a custom session name
$secure = SECURE;
// This stops JavaScript being able to access the session id.
$httponly = true;
// Forces sessions to only use cookies.
if (ini_set('session.use_only_cookies', 1) === FALSE) {
header("Location: ../error.php?err=Could not initiate a safe session (ini_set)");
exit();
}
// Gets current cookies params.
$cookieParams = session_get_cookie_params();
session_set_cookie_params($cookieParams["lifetime"], $cookieParams["path"], $cookieParams["domain"], $secure, $httponly);
// Sets the session name to the one set above.
session_name($session_name);
session_start(); // Start the PHP session
session_regenerate_id(); // regenerated the session, delete the old one.
}