TP6修改查询数据数组时报错Indirect modification of overloaded element of thinkCollection has no effect解决办法

146次阅读

共计 600 个字符,预计需要花费 2 分钟才能阅读完成。

TP6 操作 DB 类查询数据库中查询到的数据,修改元素时,会报错:

1
Indirect modification of overloaded element of thinkCollection has no effect

TP6 修改查询数据数组时报错 Indirect modification of overloaded element of thinkCollection has no effect 解决办法

解决的办法简单,引用一下数据库查询到的数据即可。比如:

1
2
$list = Db::table(‘bill_data’)->where($where)->where(‘state’,‘ 新增 ’)->whereOr(‘delete_time’,‘not null’)->order(‘update_time desc’)->limit(intval($from),intval($limit))->select();
$list = $list->all();

第二行就是,随后继续 foreach 等操作即可。

正文完