我正在尝试在这个嵌套的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;
答案 0 :(得分:3)
如果您选中输出,则表明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
编辑:看起来您使用选项卡代码更新了问题。当我看到它时,很难分辨哪些属性属于哪些对象。