-1
簡單的問題,我正在努力尋找答案。我有一個數組如下:訪問對象數組中的屬性
$t = wp_get_post_tags($post->ID);
print_r($t);
,其結果是:
Array
(
[0] => stdClass Object
(
[term_id] => 4
[name] => tag2
[slug] => tag2
[term_group] => 0
[term_taxonomy_id] => 4
[taxonomy] => post_tag
[description] =>
[parent] => 0
[count] => 7
)
[1] => stdClass Object
(
[term_id] => 7
[name] => tag5
[slug] => tag5
[term_group] => 0
[term_taxonomy_id] => 7
[taxonomy] => post_tag
[description] =>
[parent] => 0
[count] => 6
)
[2] => stdClass Object
(
[term_id] => 16
[name] => tag6
[slug] => tag6
[term_group] => 0
[term_taxonomy_id] => 16
[taxonomy] => post_tag
[description] =>
[parent] => 0
[count] => 2
)
)
如何獲得[COUNT]值的值的第一個[0],第二個[1所述陣列中]和第三[2]?
'$ T [0] - > count','$ T [1] - > count','$ T [2] - > count' – Bora
感謝。我一直在尋找解決方案長達1小時。並最終由您解決。 – user3148904
有人會同意標題混淆嗎?我不知道是否應該將它改爲:「訪問一個對象數組中的屬性」,還是那個太激進? – thpl