0
看看这个代码,并请告诉我这怎么可能,这完美的作品星期三,而不是星期二:PHP strtotime错误?
<?php
$current_time = strtotime('now');
if ($current_time > strtotime('tuesday this week 8:45pm') && $current_time < strtotime('tuesday this week 11:45pm')) {
$background = 1;
}
if ($current_time > strtotime('wednesday this week 8:45pm') && $current_time < strtotime('wednesday this week 11:45pm')) {
$background = 1;
}
else{
$background = 0;
}
?>
<script>
var backday = <?php echo json_encode($background); ?>;
</script>
周二,则返回0,但周三则返回1,如这应该。为什么?
取决于你设置的时区。对我来说,他们都应该返回0. –
我假设你的意思是这个时间间隔在星期二执行时不起作用,但是它在两个星期三之间的星期三执行时有效吗? – ajon
当你运行这个服务器时,你的服务器(不是本地)是什么时间? – 2012-09-18 20:32:28