![](/img/trans.png)
[英]Can a property of a PHP object be an array? And if so how do I add to it from within the object?
[英]How can I access object property within this nested array?
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
)
)
)
)
一直在尝试这样的事情:
print $node->field_price['und']['0']['tid']->taxonomy_term;
这就像一个嵌套数组,其中也有一个对象。.我不太确定如何获取似乎位于其中的对象内的[description]属性。
有什么帮助吗? 请!
尝试:
echo $node->field_price['und'][0]['taxonomy_term']->description;
尝试这个:
print $node->field_price[LANGUAGE_NONE]['0']['taxonomy_term']->description;
LANGUAGE_NONE是具有未定义语言的“键”名称的常量,并且在整个Drupal中使用。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.