我是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的值?
非常感谢!
答案 0 :(得分:3)
这些不是数组,而是包含包含对象的数组的对象。 PHP对象访问语法与->
$variableName->contacts[0]->contactId