本文介绍了如何打印嵌套的stdclass对象数组的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试在此嵌套的stdClass对象中打印值,但是在访问它们时遇到了麻烦.如何打印ID?
I am trying to print values in this nested stdClass Object but I'm having trouble accessing them. How do I print the ID?
stdClass Object (
[AddUserWithLimitResult] => stdClass Object (
[Header] => stdClass Object (
[Code] => UserAdded
[Description] => User created
)
[ID] => 2243272
[UserName] => gmail.com
[FirstName] => sar
[LastName] => Sea
[Email] => gmail.com
[SubDomain] => olo
)
)
我尝试过:
$object->AddUserWithLimitResult->Header->Code->ID;
推荐答案
如果您将输出选项卡出,则很明显ID是AddUserWithLimitResult的属性
If you tab out the output it becomes clear that ID is a property of AddUserWithLimitResult
stdClass Object (
[AddUserWithLimitResult] => stdClass Object (
[Header] => stdClass Object (
[Code] => UserAdded
[Description] => User created
)
[ID] => 2243272
[UserName] => gmail.com
[FirstName] => sar
[LastName] => Sea
[Email] => gmail.com
[SubDomain] => olo
)
)
$object->AddUserWithLimitResult->ID
您似乎已使用选项卡式代码更新了问题.当我看到它时,很难分辨出哪些属性属于哪些对象.
It looks like you updated the question with the tabbed code. When I saw it it was difficult to tell which properties belonged to which objects.
这篇关于如何打印嵌套的stdclass对象数组的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!