$total = hinkDb::name('ad')->where($where)->count()

易优教程 强烈建议 2024-03-15 07:35 105 0

  在仿站的过程中,有时需要调用广告组内的广告数量,可是又没有相对应的标签,如何解决呢?使用下面方法即可完美解决;打开 extendfunction.php 文件,复制下面代码粘贴进去// 获取广告组内广告的数量if (!function_exists('diy_adv_total')) { function diy_adv_total($pid = 0) { $total = 0; $pid = intval($pid); if (!empty($pid)) { $where = [ 'pid' => $pid, 'status' => 1, 'is_del' => 0, 'lang' => get_home_lang(), ]; $total = hinkDb::name('ad')->where($where)->count(); }

  echo intval($total); }}

  前端模板调用标签:{eyou:php}diy_adv_total(1);{/eyou:php}

  此广告组的广告是三个,那么标签调用的值即为3;

本站资源均来自互联网或会员发布,如果不小心侵犯了您的权益请与我们联系。我们将立即删除!谢谢!