我有一个变量“$terms”,具有以下内容/结构:
Array
(
[507] => stdClass Object
    (
        [term_id] => 507
        [name] => Blog
        [slug] => blog
        [term_group] => 0
        [term_taxonomy_id] => 679
        [taxonomy] => blog-category
        [description] => 
        [parent] => 0
        [count] => 3
        [object_id] => 13665
    )
[494] => stdClass Object
    (
        [term_id] => 494
        [name] => ZMisc
        [slug] => misc
        [term_group] => 0
        [term_taxonomy_id] => 662
        [taxonomy] => blog-category
        [description] => 
        [parent] => 0
        [count] => 5
        [object_id] => 13665
    )
)
我需要获取第一个对象名称的值。所以在这种情况下,我需要检索“博客”的值。该数组当前存储为 $terms。我已经在这个 sytnax 的其他一些变体中尝试了 $terms[0]->name ,但不能完全得到我需要的东西。