尝试写一个IF语句来显示圣诞节开放时间,使用公式,如果今天的日期在12月1日和1月5日之间,否则显示正常时间。但我得到的只是平常的时光。
$xmasStart = date('m-d', strtotime('11-01'));
$xmasEnd = date('m-d', strtotime('01-05'));
if((date('m-d') > $xmasStart) && (date('m-d') < $xmasEnd)) {
echo 'Christmas Opening Hours';
} else {
echo '<p class="marginbottom0">Monday to Friday: 8am - 6pm<br><small>Saturday & Sunday: Appointment only</small></p>';
}https://stackoverflow.com/questions/47474529
复制相似问题