session_start();
$t = time();//当前时间
$changeTime = 300;// 时间间隔,单位:秒
$mima = '202406';//初始
if(isset($_SESSION['time'])){
if(($t - $_SESSION['time']) >= $changeTime){
$_SESSION['time'] = $t;$mima = mt_rand(99999, 999999);$_SESSION['rand'] = $mima;
}else{
$mima = $_SESSION['rand'];
}
}else{
$_SESSION['time'] = $t;$mima = mt_rand(0, 9999);$_SESSION['rand'] = $mima;
}
echo $mima;
留言咨询