这是 print_r($object) 的结果:
Array
(
[0] => stdClass Object
(
[title] => Test procedures in watermelons
[nid] => 494
[type] => chsmanuscript
)
[1] => stdClass Object
(
[title] => How to eat cookies
[nid] => 520
[type] => chsmanuscript
)
)
如何在此对象数组中手动添加第三个对象项?我尝试了以下方法,但它不起作用:
$object[2]->title = 'test';
$object[2]->nid = '999';
$object[2]->type = 'chsmanuscript'
错误是:致命错误:无法使用 DatabaseStatementBase 类型的对象作为数组