站点统计
  • 文章 4048
  • 标签 484
  • 分类 182
  • 留言 416
  • 用户 494
  • 浏览 810620304
  • 运营 996 天
关于我们
  • 张三
  • 互联网前端工程师
  • 湘ICP备20000000号-1

zblog获取最近更新当天发布文章数量
老翰 2020-10-27 2496

有朋友求助怎么获取zblog当天发布文章数量统计?他说网上好多教程都是24小时的方法,也有当天发布的教程,但大多数都是语句错误用不了。今天我来教大家怎么正确的调用当天更新的文章数量方法。

一:获取当天内发布文章数量

1、把以下代码添加到主题的include.php文件:

function z556_postNum(){
	global $zbp;
	$gettime = strtotime(date("Y-m-d"));//当天时间
	$db = $zbp->db->sql->get();
	$sql = $db->select('zbp_post')->where(array(array('=','log_Status','0'),array('>','log_PostTime',$gettime)))->sql;	
	$array = $zbp->GetListType('Post', $sql);
	echo count($array);	
}

2、在要调用显示更新数量的位置添加调用代码:

最近更新:{z556_postNum()}

二:获取24小时内发布文章数量

1、把以下代码添加到主题的include.php文件:

function z556_postNum(){
	global $zbp;
	$nowtime = time();//当前时间
	$settime = 1*24*60*60;//24小时时间
	$gettime = $nowtime-$settime;//当前时间减24小时
	$db = $zbp->db->sql->get();
	$sql = $db->select('zbp_post')->where(array(array('=','log_Status','0'),array('>','log_PostTime',$gettime)))->sql;	
	$array = $zbp->GetListType('Post', $sql);
	echo count($array);	
}

2、在要调用显示更新数量的位置添加调用代码:

最近更新:{z556_postNum()}

24小时这种方法获取我觉得并不实用,因为他是从当前时间计算的,比如我今天11:10分更新了一篇文章,则明天11:10分才会重置,当然还得看各位朋友们的需求,大家喜欢用那种就用那种吧,以上二种方法我都写出来了。

Comments 0 条评论
评论头像 点击填写昵称和邮箱,方可发布评论

没有评论

27202010https://556z.com/zb_users/theme/Moments/images/10.pngzblog获取最近更新当天发布文章数量有朋友求助怎么获取zblog当天发布文章数量统计?他说网上好.....https://556z.com/zb_users/theme/Moments/plugin/img/poster_okclose.pnghttps://556z.com/zb_users/theme/Moments/plugin/api.php?url=https://556z.com/zb_users/theme/Moments/plugin/img/poster_zw.png556资源网
听听音乐 定时刷新 监听刷新 返回上页 返回顶部
公司地址

客服QQ

QQ二维码

客服微信

VX二维码
内容详情
00