大批
Array
(
[1] => stdClass Object
(
[id] => 1
[reg_type_id] => birth
[mem_tbl_id] => 1
[reg_date] => 1937-09-18
)
[2] => stdClass Object
(
[id] => 3
[reg_type_id] => birth
[mem_tbl_id] => 2
[reg_date] => 1945-02-06
)
[3] => stdClass Object
(
[id] => 4
[reg_type_id] => birth
[mem_tbl_id] => 3
[reg_date] => 1968-04-12
)
)
需要将“reg_date”重命名为“do_birth”
我尝试更改密钥但出现“无法将 stdClass 类型的对象用作数组”错误。
foreach ($birth as $k => $v) {
$birth[$k] ['do_birth'] = $birth[$k] ['reg_date'];
unset($birth[$k]['reg_date']);
}
以上几行代码对我不起作用!
守候你守候我