emlog博客站点今日更新,全站资源数量统计美化过的代码
emlog博客站点今日更新,全站资源数量统计美化过的代码,代码有些缺陷,可以自行删掉些。话不多说直接上代码。
原文地址:https://iooqp.cn/?post=708
一般的话都是放在首页统计,比如说fee,可以把它放在log_list.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可以丢在当前文件或者头部文件header.php也可以丢在mian.css文件里头(强制全新即可)
.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;
}
.zuixin {
height: 28px;
line-height: 28px;
color: #fff;
left: 0;
display: inline-block;
text-align: center;
padding: 0 10px;
border-radius: 5px;
}