如何为会话设置无限时间到 cookie?我尝试了以下方法,但一天后我的会话中仍然收到未定义的索引通知:
setcookie('idcourse', 'CourseID', 9999999999);
setcookie('namecourse', 'CourseName', 9999999999);
setcookie('id', 'ID', 9999999999);
if (isset($_POST['idcourse'])) {
$_SESSION['idcourse'] = $_POST['idcourse'];
}
if (isset($_POST['namecourse'])) {
$_SESSION['namecourse'] = $_POST['namecourse'];
}
if (isset($_POST['id'])) {
$_SESSION['id'] = $_POST['id'];
}