这是我的脚本,它是 php 和 javascript 的组合
<?php
$countdown = strtotime("22:00") - time();
$itemtime = "22:00";
$realtime = substr(date('H:i'),0,5);
?>
<script>
var itemtime = "$itemtime";
var countdown = '$countdown';
var url = "$redirectpage";
var realtime = "$realtime";
// HOW WILL I ADD AN IF STATEMENT WITH THE SETTIMEOUT FUNCTION
// WHEREBY, if(realtime == itemtime) ..that's the only time the
// redirection should occur
setTimeout(function(){
location.href='$redirectpage';
},countdown * 1000);
</script>