【发布时间】:2018-03-19 08:00:30
【问题描述】:
我在这里有点困惑。在我的项目中,我需要按日期显示房间的价格。例如 。 从 2017 年 10 月 1 日到 2017 年 10 月 31 日,价格为 200 美元。 从 11 月 1 日到 11 月 30 日的价格是 250 美元,依此类推......
现在我正在尝试这样做......
<?php
$currnt_time = time();
$from_date = strtotime(2017-10-01);
$till_date = strtotime(2017-10-31);
if ($currnt_time >= $from_date && $currnt_time < $till_date){
$price = $200;
}
?>
<P> Starts FROM <?php echo $price; ?> INR</P>
但是当我运行这个脚本时,它说 undefined variable $price 。我不明白我错在哪里),因为我将有很多像上面这样的日期时段,所以解决这个问题的最佳方法是什么。 请帮忙。谢谢!
【问题讨论】:
-
除了一些我认为来自 sn-p 编辑的语法错误之外,should work