我有一个像drupal这样的数组输出,如何从中访问[name]的值 field_episode_tags,到目前为止我有这个
print $node->field_episode_tags['und']['0']['taxonomy_term']->['name']
当我达到'分类学术语'时,我尝试使用另一个对象 - > poitner但是没有用。
stdClass Object
(
[vid] => 25
[uid] => 1
[title] => Is there any cosmos theory?
[log] =>
[status] => 1
[comment] => 1
[promote] => 0
[sticky] => 0
[nid] => 25
[type] => tv_episode
[language] => en
[created] => 1380610491
[changed] => 1381115053
[tnid] => 0
[translate] => 0
[revision_timestamp] => 1381115053
[revision_uid] => 1
[body] => Array
(
[und] => Array
(
[0] => Array
(
[value] => summary text summary text summary text summary text summary text summary text summary text summary text summary text summary text summary text summary text summary text summary text summary text summary text summary text summary text summary text summary text summary text summary text summary text summary text summary text summary text summary text summary text summary text summary text summary text summary text summary text summary text summary text summary text summary text summary text summary text
[summary] =>
[format] => filtered_html
[safe_value] => <p>summary text summary text summary text summary text summary text summary text summary text summary text summary text summary text summary text summary text summary text summary text summary text summary text summary text summary text summary text summary text summary text summary text summary text summary text summary text summary text summary text summary text summary text summary text summary text summary text summary text summary text summary text summary text summary text summary text summary text</p>
[safe_summary] =>
)
)
)
[field_video_category] => Array
(
[und] => Array
(
[0] => Array
(
[tid] => 25
)
)
)
[field_featured] => Array
(
)
[field_kaltura_video] => Array
(
) und 0 taxonomy term->name
[field_episode_tags] => Array
(
[und] => Array
(
[0] => Array
(
[tid] => 95
[taxonomy_term] => stdClass Object
(
[tid] => 95
[vid] => 1
[name] => zen
[description] =>
[format] =>
[weight] => 0
[vocabulary_machine_name] => tags
[rdf_mapping] => Array
答案 0 :(得分:1)
您需要直接访问实例datamember而不使用方括号[]。这些用于数组键。
print $node->field_episode_tags[LANGUAGE_NONE]['0']['taxonomy_term']->name