从 Web 服务接收的对象/多维数组中检索值
我正在调用 Web 服务,并收到此响应,我可以使用 var_dump 查看该响应。如何获取名称值?还有,这是什么结构?
object(DescribeEntityTypeResponse)#2 (1) {
["DescribeEntityTypeResult"]=>
object(DescribeEntityTypeResult)#6 (1) {
["EntityTypes"]=>
object(ArrayOfEntityType)#7 (1) {
["EntityType"]=>
array(5) {
[0]=>
object(EntityType)#8 (3) {
["ID"]=>
int(0)
["Name"]=>
string(7) "Contact"
["Type"]=>
string(4) "Base"
}
[1]=>
object(EntityType)#9 (3) {
["ID"]=>
int(0)
["Name"]=>
string(7) "Company"
["Type"]=>
string(4) "Base"
}
[2]=>
object(EntityType)#10 (3) {
["ID"]=>
int(0)
["Name"]=>
string(8) "Prospect"
["Type"]=>
string(4) "Base"
}
[3]=>
object(EntityType)#11 (3) {
["ID"]=>
int(0)
["Name"]=>
string(7) "Visitor"
["Type"]=>
string(4) "Base"
}
[4]=>
object(EntityType)#12 (3) {
["ID"]=>
int(0)
["Name"]=>
string(17) "ProcessedActivity"
["Type"]=>
string(4) "Base"
}
}
}
}
}
I am calling a web service, and receive this response which I can see using var_dump. How do I get the Name value? Also, what structure is this?
object(DescribeEntityTypeResponse)#2 (1) {
["DescribeEntityTypeResult"]=>
object(DescribeEntityTypeResult)#6 (1) {
["EntityTypes"]=>
object(ArrayOfEntityType)#7 (1) {
["EntityType"]=>
array(5) {
[0]=>
object(EntityType)#8 (3) {
["ID"]=>
int(0)
["Name"]=>
string(7) "Contact"
["Type"]=>
string(4) "Base"
}
[1]=>
object(EntityType)#9 (3) {
["ID"]=>
int(0)
["Name"]=>
string(7) "Company"
["Type"]=>
string(4) "Base"
}
[2]=>
object(EntityType)#10 (3) {
["ID"]=>
int(0)
["Name"]=>
string(8) "Prospect"
["Type"]=>
string(4) "Base"
}
[3]=>
object(EntityType)#11 (3) {
["ID"]=>
int(0)
["Name"]=>
string(7) "Visitor"
["Type"]=>
string(4) "Base"
}
[4]=>
object(EntityType)#12 (3) {
["ID"]=>
int(0)
["Name"]=>
string(17) "ProcessedActivity"
["Type"]=>
string(4) "Base"
}
}
}
}
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我认为这应该可行:
但是对象可能有methods()来访问这些属性。
I think this should work:
However the objects may have methods() to access these properties.