Indirect modification of overloaded element of apilifemodelNewsModel has no effect
Posted 做网站的菜鸟
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了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;
以上是关于Indirect modification of overloaded element of apilifemodelNewsModel has no effect的主要内容,如果未能解决你的问题,请参考以下文章
Bisecting GlcNAc is a general suppressor of terminal modification of N-glycan (解读人:王茹凯)