更新时间:2023-12-04 19:34:22
首先,存储用户最后一次发出请求的时间
first, store the last time the user made a request
<?php
$_SESSION['timeout'] = time();
?>
在后续请求中,检查他们多久前一次提出请求(在此示例中为10分钟)
in subsequent request, check how long ago they made their previous request (10 minutes in this example)
<?php
if ($_SESSION['timeout'] + 10 * 60 < time()) {
// session timed out
} else {
// session ok
}
?>