zoukankan      html  css  js  c++  java
  • Indirect modification of overloaded element of apilifemodelNewsModel has no effect

    最近遇到了一个这样的问题。

    起因是我的代码:

    $user['order']=$order->alias('a')

        ->join('shop w','a.pid = w.id','left')
    ->where('a.userid',$data['id'])
    ->field('a.*,w.pic')
    ->select();
    foreach ($user['order'] as $k=>$v){
      $user['order'][$k]['pic']=$this->img($v['pic']);
    }
    然后我查了下资料,是说在循环中产生的,要设置一个中间变量。
    修改如下:
    $user['order']=$order->alias('a')
    ->join('shop w','a.pid = w.id','left')
    ->where('a.userid',$data['id'])
    ->field('a.*,w.pic')
    ->select();
    $res=$user['order'];
    foreach ($res as $k=>$v){
    $v['pic']=$this->img($v['pic']);
    $res[$k]=$v;
    }
    $user['order']=$res;
     
  • 相关阅读:
    iOS
    iOS
    iOS
    iOS
    iOS
    iOS
    iOS
    iOS
    iOS
    【转】idea 用maven骨架生成项目速度慢的问题
  • 原文地址:https://www.cnblogs.com/cici1989/p/11977758.html
Copyright © 2011-2022 走看看