简介
其实代码很简单的,就是统计今日更新和文章总数的代码,写一下时间判断就可以了。
下面是24小时更新文章,3天更新和10天更新的判断代码。
教程
代码放在了log_list.php文件里面
代码
<div class="lead-title">
<table cellpadding="0" cellspacing="0" border="1" style="width:100%;font-weight:700;text-align:center;" bordercolor="#ff5500">
<tbody>
<td height="28" colspan="5" style="font-size:15px;">
<b>
<div id="bdcs"></div>
<marquee scrollamount="3" behavior="alternate">
<span style="font-size:13px;color:#000000;"> <p><?php
$Log_Model = new Log_Model();
$today = strtotime(date('Y-m-d'));//今天凌晨时间戳
$threeday = strtotime(date('Y-m-d',strtotime('-3 day')));//3天前凌晨时间戳
$tenday = strtotime(date('Y-m-d',strtotime('-10 day')));//10天前凌晨时间戳
$today_sql = "and date>$today";
$today_num = $Log_Model->getLogNum('n', $today_sql);
$threeday_sql = "and date>$threeday";
$threeday_num = $Log_Model->getLogNum('n', $threeday_sql);
$tenday_sql = "and date>$tenday";
$tenday_num = $Log_Model->getLogNum('n', $tenday_sql);
if($tenday_num=='0'){echo '这博客已经废了 都10几天了 没有更新内容 | ';}
elseif($threeday_num=='0'){echo '这博客快要荒废了 连续3天都没有更新文章了 | ';}
elseif($today_num=='0'){echo '今日站长很懒 一篇文章都没更新 | ';}
else{echo ' <b>今日已更新<b style="color:red">'.$today_num.'</b>个资源 | </b> ';}
?><b>本站共分享了<b style="color:re
d"><?php echo $sta_cache['lognum'];?></b>个资源</b></p></span></marquee></b>
</td> </tr>
</tbody>
</table>
</div>
评论