我使用以下代码生成数组:$array = get_field('footballers','option');
。
然后我运行print_r($array);
并得到以下输出:
stdClass Object
(
[term_id] => 75
[name] => John Barnes
[slug] => john-barnes
[term_group] => 0
[term_taxonomy_id] => 77
[taxonomy] => theme
[description] =>
[parent] => 0
[count] => 18
[object_id] => 1089
[filter] => raw
)
如何从数组中访问slug
密钥,以便获得$slug
变量?
感谢
这样?
$array->slug;
它是一个对象,而不是数组。