thinkphp5.0 分页循环添加数据

浏览:2500 发布日期:2017/06/01 分类:求助交流 关键字: tp5 分页 添加数据
$db = db('product');
$app_db = db('productapp');

$where = array();
$where['userid'] = ['=',session('indexUserID')];

$list = $db->where($where)->paginate(10);

$list->toArray();
foreach($list as $k=>$v){
$whereApp = array();
$whereApp['pid'] = ['=',$v['pid']];
$whereApp['state'] = ['=',1];

$app = $app_db->where($whereApp)->field('sum(apptype) as appNum')->find();
$appNum = $app['appNum'];
$dataAry['appNum'][$v['pid']] = $appNum;

$data = array();
$data = $v;
$data['appNum'] = $appNum;

$list->offsetSet($k,$data);
}
最佳答案
评论( 相关
后面还有条评论,点击查看>>