获取网站今天更新的文章数量和全站文章数量。把PHP代码放在首页文件你想要的位置即可!
<div class="zuixin"style="background: linear-gradient(to right,#28b3f7 0,#ff00ff 100%);">
<span class="zx" style="font-size:13px;">
<i class='fa fa-line-chart'></i>最新发布 </span>
</div>
<span class="youqing_more2"style="background: linear-gradient(to right,#ff00ff 0,#28b3f7 100%);">
<span class="zx" style="font-size:13px;">
<?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:red"><?php echo $sta_cache['lognum'];?></b>个资源</b>
</span>
</span>
</div>
CSS代码:
放在公用CSS文件,也可以直接放在当前文件。
.zuixin {
height: 28px;
line-height: 28px;
color: #fff;
left: 0;
display: inline-block;
text-align: center;
padding: 0 10px;
border-radius: 5px;
}
.youqing_more2 {
float: right;
right: 0;
text-indent: 0px;
margin-right: 0px;
height: 28px;
position: absolute;
right: 0;
text-transform: uppercase;
line-height: 26px;
letter-spacing: 1px;
background: #2196F3;
color: #fff;
display: inline-block;
padding: 0 10px;
text-align: center;
margin-left: 6px;
border-radius: 5px;
}
版权说明
文章采用: 《署名-非商业性使用-相同方式共享 4.0 国际 (CC BY-NC-SA 4.0)》许可协议授权。版权声明:未标注转载均为本站原创,转载时请以链接形式注明文章出处。如有侵权、不妥之处,请联系站长删除。敬请谅解!
劲舞团问道密传一条龙www.81uv.c...