如何从节点分类类型字段获取单个值
我有这个输出:,我想到达“中心”。
[field_affiliation] => Array(
[und] => Array(
[0] => Array(
[tid] => 30
[taxonomy_term] => stdClass Object(
[tid] => 30
[vid] => 2
[name] => Center
我可以使用这个方法吗?$affiliation=$node->field_affiliation['und']['0']['value']['taxonomy_term']['name'];
或如何使用: drupal_array_get_nested_value();
- 我无法理解文档
I have this output:, and I want to get to "Center".
[field_affiliation] => Array(
[und] => Array(
[0] => Array(
[tid] => 30
[taxonomy_term] => stdClass Object(
[tid] => 30
[vid] => 2
[name] => Center
Can I use this method?$affiliation=$node->field_affiliation['und']['0']['value']['taxonomy_term']['name'];
or how can I use:drupal_array_get_nested_value();
- I cannot understand the documentation
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
试试这个,它会起作用
因为名称位于对象“taxonomy_term”下
$affiliation=$node->field_affiliation['und']['0']['taxonomy_term']->name;
Try this it will work
as the name is under the object 'taxonomy_term'
$affiliation=$node->field_affiliation['und']['0']['taxonomy_term']->name;