PHP通过倒计时重定向而不更新



简而言之,我想在16:00将用户重定向到ex:breakout.php。想知道我是否可以在没有JavaScript的情况下完成它?

您可以使用元重定向标记并指定重定向之前的秒数

<meta http-equiv="Refresh" content="1; URL=https://example.com/">

content参数是秒数。您可以使用PHP计算从现在到16:00之间的秒数,并生成正确的值。

希望这将对您有所帮助!!!

date_default_timezone_set('Australia/Adelaide'); //Sets the default timezone
$time = strtotime(date("h", time()));
if($time >= strtotime("16:00:00")){
header("location: breakout.php");
exit;
} 

最新更新