我正在使用 CakePHP 并检索用户信息,进行计算,然后我想将该计算添加到每个用户的数组中
查了一个用户后,这是数组的结构
print_r($user_info);
Array
(
[0] => Array
(
[User] => Array
(
[id] => 1
[email] => admin@gmail.com
[website] => www.admin.com
)
)
)
现在我正在尝试在循环中为这个特定用户添加一个“num_payments”键
array_push($user_info[$i]['User'],array('num_payments' => $customer_payments[$i]['num_payments']));
这是结果数组
Array
(
[0] => Array
(
[User] => Array
(
[id] => 1
[email] => admin@gmail.com
[website] => www.admin.com
[0] => Array
(
[num_payments] => 1
)
)
)
)
我怎样才能让它进入这个结构?
Array
(
[0] => Array
(
[User] => Array
(
[id] => 1
[email] => admin@gmail.com
[website] => www.admin.com
[num_payments] => 1
)
)
)