我想打印一个像" live" ,"即将到来"等等基于日期和时间
如果文章日期和时间等于当前日期和时间,则会立即打印
如果文章日期或时间是过去的话,则不显示任何内容
如果文章日期是将来,则显示即将发布的
这是我的剧本:
/*--------------------------------------------------------*/
/*Validating time to print live or upcoming etc*/
/*--------------------------------------------------------*/
if($article_date >= $today_date) {
if($today_hours < $article_shours) {
$status = "<p class='upcoming'>1Coming Soon</p>";
}
elseif(($today_hours >= $article_shours) && ($article_date == $today_date)) {
if( ($today_hours >= $article_shours) && ($today_minutes >= $article_sminutes) ) {
$status = "<p class='live'>2live</p>";
} else {
$status = "<p class='upcoming'>3Coming soon</p>";
}
if($today_minutes >= $article_sminutes) {
$status = "<p class='live'>4live</p>";
}
} else {
$status = "<p class='upcoming'>6Coming soon</p>";
}
} else {
$status = "<p class='upcoming'>7Coming soon</p>";
}
if($article_date < $today_date) { // if the date is passed then do nothing
if( $today_date > $article_end_date) {
$status = "8";
}
}
/*--------------------------------------------------------*/
/*Validating time to print live or upcoming etc ENDS here*/
/*--------------------------------------------------------*/
但由于效果不佳,仍有一些问题