标签:als content original list return null dsl name UNC
// 官网商品链接 public function index(){ $goods_name = I(‘goods_name‘); // goods_name $goodslist = Db::name(‘goods‘)->field(‘goods_id,goods_name,goods_content,endtime,shop_price,original_img‘) ->where($where) ->whereNull(‘delete_time‘) ->paginate(25); // 只需这样子就可以获取到可以循环的数组了 $data = $goodslist->all(); foreach($data as $k=>&$v){ $v[‘img‘] = ‘_public_/‘.$v[‘img‘]; // 直接付给上边的那个数组里 // 但是注意不能这样写 $goodslist[$k][‘img‘] = ‘_public_/‘.$v[‘img‘]; 这样写不起作用 // 只能 再这样付给$goodslist数组才行 $goodslist[$k] = $v; } return $goodslist; }
原文http://gongfuma.com/front/tech/detail/id/301/typeid/1.html
thinkphp分页paginate获取可以foreach的数据
标签:als content original list return null dsl name UNC
原文地址:https://www.cnblogs.com/dwq521/p/12912559.html