Blogger Information
Blog 55
fans 0
comment 0
visits 59366
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
tp5 分页后数据处理
南鸢离梦的博客
Original
1281 people have browsed it
  1. V5.0.9版本开始 支持分页类后数据直接each遍历处理,方便修改分页后的数据,而不是只能通过模型的获取器来补充字段。
  2. $list = User::where('status',1)->paginate()->each(function($item, $key){ $item->nickname = 'think';});
  3. 如果是Db类操作分页数据的话,each方法的闭包函数中需要使用返回值,例如:
  4. $list = Db::name('user')->where('status',1)->paginate()->each(function($item, $key){ $item['nickname'] = 'think'; 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