还是在Common.php上写:

/*
 * slide 获取幻灯片
 * 具体使用:
 <?php $slide = slide();?>
 <foreach name="slide" item="v">
 <img src="__ROOT__/upload/{$v['image']}">            
 </foreach>
 */
function slide($slide_id = 1){
    $where = array();
    $where['slide_id'] = 1;
    $where['status'] = 1;
    $slide = Db::name('slide_item')->where($where)->select();
    return $slide;
}

具体调用:

<?php $slide = slide();?>
<foreach name="slide" item="v">
<li class='con' style="display:inline; background:url('__ROOT__/upload/{$v['image']}') no-repeat center center;"></li>                
</foreach>

 

相关文章:

  • 2021-11-11
  • 2021-12-28
  • 2021-08-05
  • 2021-11-15
  • 2021-06-01
  • 2021-08-18
  • 2022-12-23
  • 2022-01-21
猜你喜欢
  • 2022-12-23
  • 2021-08-12
  • 2021-09-16
  • 2022-12-23
  • 2021-06-19
相关资源
相似解决方案