thinkphp 数据嵌套输出
thinkphp 数据嵌套输出
$list=Db::name('a')->field('id,xxx,...')->group('rwid')->select();
$data['list']=[];
foreach ( $list as $v){
$part=Db::name('a')->field('id,xxx,...')->where('rwid',$v['rwid'])->select();
foreach ( $part as $v1){
$v1['partsn']=Db::name('b')->field('id,partsn')->where('apid',$v1['id'])->select();
$v['part'][]=$v1;
}
$data['list'][]=$v;
}
dump($data);