如何在php中获取stdclass对象值

时间:2015-05-27 15:33:57

标签: php stdclass

stdClass Object
(
[Transaction] => stdClass Object
    (
        [Reference1] => 001
        [Reference2] => 
        [Reference3] => 
        [Reference4] => 
        [Reference5] => 
    )

[Notifications] => stdClass Object
    (
    )

[HasErrors] => 
[Shipments] => stdClass Object
    (
        [ProcessedShipment] => stdClass Object
            (
                [ID] => 3702106321
                [Reference1] => Shpt 0001
                [Reference2] => 
                [Reference3] => 
                [ForeignHAWB] => 
                [HasErrors] => 
                [Notifications] => stdClass Object
                    (
                    )

                [ShipmentLabel] => stdClass Object
                    (
                        [LabelURL] => http://www.sandbox.aramex.com/content/rpt_cache/cc1703518ef04f13873f8c2a2fab04fb.pdf
                        [LabelFileContents] => 
                    )
            )
    )

任何人都可以帮助我如何检索ID的值?

1 个答案:

答案 0 :(得分:2)

这样的事情:

$your_object->Shipments->ProcessedShipment->ID

其中,$your_object包含您在此处发布的回复。