所以,很明显,不幸的是你不能使用PHP创建一个resfreshing非静态倒数计时器,因为它是一种服务器端语言,所以经过一些挖掘后我发现了一个可以做到的Javascript脚本。
但是,目标日期是我从数据库获得的变量,存储在PHP变量中。我想要做的是将该变量用作javascript上的目标日期,但我没有成功。
<?php echo "You are currently looting a " . "<b>" . $lootinglocation . "</b> | <b> Time remaining: </b>
<script language='JavaScript'>
TargetDate = '" . $javatime . "';
BackColor = 'palegreen';
ForeColor = 'navy';
CountActive = true;
CountStepper = -1;
LeadingZero = true;
DisplayFormat = '%%M%% Minutes, %%S%% Seconds.';
</script>
<script language='JavaScript' src='//scripts.hashemian.com/js/countdown.js'></script>'";
?>
需要考虑的事项:
这是$ java time:`
的声明$targettime = $dbtime; //This $dbtime is obtained trough a select query.
$currenttime = strtotime(date('Y-m-d H:i:s'));
$timeremaining = $targettime - $currenttime;
$addedtime = "+" . $timeremaining . " seconds";
$javatime = date("m/d/Y h:i:s A", strtotime($addedtime));`
答案 0 :(得分:0)
您在脚本中缺少http:
+------+-------+--------------------+--------------------+------------+---------+
| minN | maxN | minBatchSequenceNo | maxBatchSequenceNo | BatchCount | BatchNo |
+------+-------+--------------------+--------------------+------------+---------+
| 1 | 500 | 1 | 500 | 500 | 1 |
| 501 | 1000 | 1 | 500 | 500 | 2 |
| 1001 | 1500 | 1 | 500 | 500 | 3 |
| 1501 | 2000 | 1 | 500 | 500 | 4 |
| 2001 | 2500 | 1 | 500 | 500 | 5 |
| 2501 | 3000 | 1 | 500 | 500 | 6 |
| 3001 | 3500 | 1 | 500 | 500 | 7 |
| 3501 | 4000 | 1 | 500 | 500 | 8 |
| 4001 | 4500 | 1 | 500 | 500 | 9 |
| 4501 | 5000 | 1 | 500 | 500 | 10 |
| 5001 | 5500 | 1 | 500 | 500 | 11 |
| 5501 | 6000 | 1 | 500 | 500 | 12 |
| 6001 | 6500 | 1 | 500 | 500 | 13 |
| 6501 | 7000 | 1 | 500 | 500 | 14 |
| 7001 | 7500 | 1 | 500 | 500 | 15 |
| 7501 | 8000 | 1 | 500 | 500 | 16 |
| 8001 | 8500 | 1 | 500 | 500 | 17 |
| 8501 | 9000 | 1 | 500 | 500 | 18 |
| 9001 | 9500 | 1 | 500 | 500 | 19 |
| 9501 | 10000 | 1 | 500 | 500 | 20 |
+------+-------+--------------------+--------------------+------------+---------+