2

我是 PHP 新手,正在尝试从以下访问“contactId”的值:

object(stdClass)#2 (4) { 
    ["contacts"]=> array(1) { 
        [0]=> object(stdClass)#3 (18) { 

            ["email"]=> string(24) "joewilliams@icontact.com" 
            ["firstName"]=> string(3) "Joe" 
            ["lastName"]=> string(8) "Williams" 
            ["prefix"]=> string(3) "Mr." 
            ["suffix"]=> string(3) "Jr." 
            ["fax"]=> string(0) "" 
            ["phone"]=> string(10) "8668039462" 
            ["street"]=> string(21) "2365 Meridian Parkway" 
            ["street2"]=> string(0) "" 
            ["city"]=> string(6) "Durham" 
            ["state"]=> string(2) "NC" 
            ["postalCode"]=> string(5) "27713" 
            ["createDate"]=> string(19) "2013-03-30 21:22:28" 
            ["status"]=> string(6) "normal" 
            ["bounceCount"]=> NULL 
            ["contactId"]=> string(8) "67295434" 
        } 
    } 
    ["limit"]=> int(20) 
    ["offset"]=> int(0) 
    ["total"]=> int(1) 
} 

如何检索contactId的值?

非常感谢!

4

1 回答 1

3

这些不是数组,而是包含包含对象的数组的对象。PHP 对象访问语法是 with->

$variableName->contacts[0]->contactId
于 2013-04-04T23:59:56.000 回答