Php 如何访问此嵌套数组中的对象属性?
我一直在尝试这样的事情:Php 如何访问此嵌套数组中的对象属性?,php,arrays,object,drupal-7,Php,Arrays,Object,Drupal 7,我一直在尝试这样的事情: Array ( [und] => Array ( [0] => Array ( [tid] => 37 [taxonomy_term] => stdClass Object ( [tid] => 37 [vid] => 9 [name] => $10 - $20
Array (
[und] => Array (
[0] => Array (
[tid] => 37
[taxonomy_term] => stdClass Object (
[tid] => 37
[vid] => 9
[name] => $10 - $20
**[description] => $10 - $20**
[format] => filtered_html
[weight] => 1
[vocabulary_machine_name] => prices
)
)
)
)
它就像一个嵌套数组,里面也有一个对象。我不确定如何获取[description]属性,它似乎在里面的对象中
有什么帮助吗?求你了 试试看:
print $node->field_price['und']['0']['tid']->taxonomy_term;
试试这个:
echo $node->field_price['und'][0]['taxonomy_term']->description;
LANGUAGE_NONE是一个常量,它具有未定义语言的“key”名称,并在Drupal中使用 致命错误:无法在第24行的C:\xampp\htdocs\drupal\sites\all\themes\simple7\node.tpl.php中将stdClass类型的对象用作数组。您确定问题中提供的是
var\u dump($node)的输出吗代码>?打印($node->field\u price);
print $node->field_price[LANGUAGE_NONE]['0']['taxonomy_term']->description;