Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/253.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 如何访问此嵌套数组中的对象属性?_Php_Arrays_Object_Drupal 7 - Fatal编程技术网

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;