0
这是我的代码,在30分钟不活动后结束sessión,在Linux中正常工作,但在Windows中无法正常工作。30分钟后脚本会话超时,在Windows中不起作用
创建会话
$_SESSION['clientdan']['user'] = $username;
$_SESSION['clientdan']['tl'] = time();
any_file.php
<?php
session_start();
$max_time = 1800;
$current = time();
if(!isset($_SESSION['clientdan']['user'])) {
header('Location: index.php');
} else {
if (!isset($_SESSION['clientdan']['tl'])){
$_SESSION['clientdan']['tl'] = time();
} else {
$session_life = $current - $_SESSION['clientdan']['tl'];
if ($session_life > $max_time) {
header('Location: include/logout.php');
} else {
$_SESSION['clientdan']['tl'] = time();
}
}
?>
<!DOCTYPE html>
......
......
<?php } ?>