Blogger Information
Blog 9
fans 0
comment 0
visits 20664
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
thinkphp5在获取分页数据之后添加额外的数据
霸霸的博客
Original
1600 people have browsed it
如果需要向分页获取的数据添加额外的数据
只需要像下面这样写就可以

实例

 $goodsList = Db::table('goods')->whereIn('id',$goodsListId)->paginate(1)->each(function($item,$key){
   //  获取的imagepath字段是以逗号分隔的字符串
   //  将字符串转化为一个数组
   $item['imagepath'] = explode(',', $item['imagepath']);
     // 将这个$item的数据返回
   return $item;
 });


Statement of this Website
The copyright of this blog article belongs to the blogger. Please specify the address when reprinting! If there is any infringement or violation of the law, please contact admin@php.cn Report processing!
All comments Speak rationally on civilized internet, please comply with News Comment Service Agreement
0 comments
Author's latest blog post