Tp5 foreach problem

foreach ($res as $k => $v) {
            $res[$k]["o_pay_types"] = $this->getPayType($res[$k]["o_pay_types"]);
        }

when running this code, an error will be reported

Indirect modification of overloaded element of think\paginator\driver\Bootstrap has no effect

what is the problem, please?

Jun.07,2021

what you use tp5 to find out is a collection object, so you can't directly use the array method to get the value. You can solve this problem by adding-> toArray () after the chain operation of the query.


check out what type of $res you are. If it is an object, use-> toArray () and then cycle


$res [$k] ['ostatic payoffs types`] may be empty or null, please print to see


have you solved the same problem?

Menu