如何打印嵌套的标准类对象数组
How to print nested stdclass object array
我试图打印这个嵌套的 stdClass 对象中的值,但我无法访问它们。如何打印 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;
如果你用 Tab 键输出,很明显 ID 是 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
编辑:您似乎使用选项卡式代码更新了问题。当我看到它时,很难分辨哪些属性属于哪些对象。
我试图打印这个嵌套的 stdClass 对象中的值,但我无法访问它们。如何打印 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;
如果你用 Tab 键输出,很明显 ID 是 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
编辑:您似乎使用选项卡式代码更新了问题。当我看到它时,很难分辨哪些属性属于哪些对象。