我有一个$images
看起来像这样的对象:
stdClass Object
(
[0] => stdClass Object
(
[id] => 125
[title] => 131301
[file_name] => 131301
[file_ext] => jpg
[dir] => Adventure/
[fk_gallery_id] => 1
)
[1] => stdClass Object
(
[id] => 126
[title] => 181301
[file_name] => 181301
[file_ext] => jpg
[dir] => Adventure/
[fk_gallery_id] => 1
)
);
现在我想获取对象中的第一个元素:
$obj = $images[0]。
这给了我错误:
Fatal error: Cannot use object of type stdClass as array
谁能告诉我为什么这不起作用?
我也试过$images[0]->id
了,但这也不起作用。