简体   繁体   English

如何打印嵌套的stdclass对象数组

[英]How to print nested stdclass object array

I am trying to print values in this nested stdClass Object but I'm having trouble accessing them. 我正在尝试在此嵌套的stdClass对象中打印值,但是在访问它们时遇到了麻烦。 How do I print the ID? 如何打印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
    )
) 

I tried this: 我尝试了这个:

$object->AddUserWithLimitResult->Header->Code->ID;

If you tab out the output it becomes clear that ID is a property of AddUserWithLimitResult 如果您将输出选项卡出,则很明显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

Edit: 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. 当我看到它时,很难分辨出哪些属性属于哪些对象。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM