【发布时间】:2023-04-04 05:45:01
【问题描述】:
我找到了这个脚本:
<?php
date_default_timezone_set('America/Los_Angeles');
$time = date('H');
if($time < 12){
echo 'good morning';
}else if($time >= 20 and $time < 21){
echo 'good afternoon';
}else{
echo 'good evening';
}
?>
并希望将其扩展为将其设置为特定的日期和时间,例如:
- 如果时间
- else if time >= 2011-11-30 14:00 and
- else echo 'after'
作为一个 php 菜鸟,我浏览了整个网络,但我能找到的唯一例子是工作日或小时,但不是上面的组合。有人可以这么好心并帮我完成这个设置吗? 提前谢谢你
【问题讨论】: