Sav*_*man 15
好吧,甚至更容易:
$current_time = strtotime('now');
if ($current_time > strtotime('wednesday this week 8:00pm') && $current_time < strtotime('thursday this week 2:00am')) {
// Special logo
}
Run Code Online (Sandbox Code Playgroud)
更换strtotime(...)东西time()以处理当前时间.
$date = strtotime('2011-03-24 01:00:00');
if ((date('w', $date) == 3 && date('H', $date) >= 20) ||
(date('w', $date) == 4 && date('H', $date) <= 1)) {
echo "it's time to change logo";
} else {
echo 'hello world';
}
Run Code Online (Sandbox Code Playgroud)