如何访问多维数组php中的值

时间:2015-03-02 08:46:19

标签: php

我有一个像这样的数组

     Array
(
    [TrackReply] => Array
        (


            [MoreData] => false
            [TrackDetails] => Array
                (
                    [Notification] => Array
                        (
                            [Severity] => SUCCESS
                            [Source] => trck
                            [Code] => 0
                            [Message] => Request was successfully processed.
                            [LocalizedMessage] => Request was successfully processed.
                        )

                    [TrackingNumber] => 123456789012
                    [TrackingNumberUniqueIdentifier] => 2457082000~123456789012~FX
                    [CarrierCode] => FDXE
                    [ServiceInfo] => FedEx International First
                    [ServiceType] => FIRST_OVERNIGHT
                    [PackageSequenceNumber] => 0
                    [PackageCount] => 0
                    [ShipTimestamp] => 2015-02-28T13:22:00+00:00
                    [DestinationAddress] => Array
                        (
                            [StateOrProvinceCode] => TN
                            [CountryCode] => US
                            [Residential] => false
                        )

                )

        )

)

从$ response和此数组中获取此数组如何获得“Notification-> Message”值,请提前帮助我

2 个答案:

答案 0 :(得分:0)

echo $array['TrackReply']['TrackDetails']['Notification']['Message'];

答案 1 :(得分:0)

您可以使用数组

进行访问
$arrayname['TrackReply']['TrackDetails']['Notification']['Message']