php tp框架分页源代码,thinkphp5中分页操作

$New_Album_List  = Db::name('MediaAlbum a')->join($this->_tab_prefix."user u", "a.user_id=u.user_id")

->join($this->_tab_prefix."fm_sound fm","fm.album_id=a.album_id")

->where('a.is_auditing=1 and a.media_type=1'.($channel_id>0?' and a.channel_id='.$channel_id:' and channel_id in ('.$ids.')'))

->field('u.nick_name,a.album_id,a.album_title,a.album_thumbnail,a.view_count,fm.is_recommend')

->order('fm.is_recommend desc,a.update_time desc')

->group('a.album_id')

->paginate(8,false,['path' => $Url,'query'=> ['channel_id'=>$channel_id]]);

/* 此处也可以用下图的方法修改,分页的Url地址 */

678f8d29309471b7d97d61031a9f7bf8.png

$this->assign('page', $New_Album_List->render());

/* 获取最新的fm导入查询专辑$New_Album_List */

$New_Album_List   = $New_Album_List->toArray();

//var_dump($New_Album_List);exit();

if (!empty($New_Album_List['data'])) {

foreach ($New_Album_List['data'] as $k => $v) {

//$v['sound_id']    = '';

//$v['sound_title'] = '';

//print_r($v['album_id']);echo "
";

$List_Fm_Sound = Db::name('FmSound')->where($v['album_id']>0?'album_id='.$v['album_id']:'1=1'.' and is_auditing=1')->field('sound_id,sound_title')->order('add_time desc')->find();

$New_Album_List['data'][$k]['sound_id'] = $List_Fm_Sound?$List_Fm_Sound['sound_id']:0;

$New_Album_List['data'][$k]['sound_title'] = $List_Fm_Sound?$List_Fm_Sound['sound_title']:0;

}

}

//print_r($New_Album_List['data']);

$this->assign('new_album_list',$New_Album_List['data']);

return $this->fetch('fm_class_pc');

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值