PHP:从数组中获取数据

时间:2012-08-22 16:09:04

标签: php arrays

我有一组看起来像这样的数据

 { [0]=> object(stdClass)#5 (19) { ["text"]=> string(39) "So true! :(" } object(stdClass)#5 (19) { ["text"]=> string(39) "Some other text"}

我试过了,但它没有返回任何数据

$content->{0}->text;  
$content->{1}->text;

如何获取此数据?它没有返回任何

1 个答案:

答案 0 :(得分:3)

这些是数组中的对象,您可以像这样访问它们:

$content[0]->text