【发布时间】:2014-08-13 05:37:47
【问题描述】:
我需要在特定日期和时间显示内容。
我目前正在使用一个脚本,它根据星期几显示内容,但需要扩展它以在两组小时之间显示内容,因此在星期一上午 12 点到下午 5 点之间然后在下午 5 点之间显示内容和晚上 11.59 点,一周中的每一天都一样。
<?php
if( date( 'w' ) == 0 ) {
?>
<div>Write what you need to show here on Sunday</div>
<?
}
if( date( 'w' ) == 1 ) {
?>
<div>Write what you need to show here on Monday</div>
<?
}
?>
<?
if( date( 'w' ) == 2 ) {
?>
<div>Write what you need to show here on Tuesday</div>
<?
}
?>
<?
if( date( 'w' ) == 3 ) {
?>
<div>Write what you need to show here on Wednesday</div>
<?
}
?>
<?
if( date( 'w' ) == 4 ) {
?>
<div>Write what you need to show here on Thursday</div>
<?
}
?>
<?
if( date( 'w' ) == 5 ) {
?>
<div>Write what you need to show here on Friday</div>
<?
}
?>
<?
if( date( 'w' ) == 6 ) {
?>
<div>Write what you need to show here on Saturday</div>
<?
}
?>
【问题讨论】:
-
你的问题是什么?
-
在每个条件中添加另一个条件以检查您想要的时间段。