我有一個JSON響應是解碼到一個數組$數據從JSON獲取變量值解碼響應
stdClass Object ([outboundSMSMessageRequest] => stdClass Object ([deliveryInfoList] => stdClass Object ([deliveryInfo] => stdClass Object ([address] => 8606142527 [deliveryStatus] => Submitted) [resourceURL] => http://api-testmobile.com/smsmessaging/1/outbound/OPNHSE/requests/urn:uuid:0f55fd13-a419-4ad9-adec-3dcf63ca39c1/deliveryInfos) [senderAddress] => OPNHSE [outboundSMSTextMessage] => stdClass Object ([message] => Sam has requested a payment of Rs 10.00.) [clientCorrelator] => [receiptRequest] => stdClass Object ([notifyURL] => [callbackData] =>) [senderName] => [resourceURL] => http://api-openhouse.testingmobile.com/smsmessaging/1/outbound/OPNHSE/requests/urn:uuid:0f5-a419-4ad9-adec-3dcf63ca39c1))
我想存儲[deliveryStatus] => Submitted
這個「提交」到一個變量。
我已經試過$dStatus=$data['deliveryStatus'];
但它不工作:(
UPDATE
我試圖通過json_decode將其轉換爲關聯數組($的數據,TRUE);
Array ([outboundSMSMessageRequest] => Array ([deliveryInfoList] => Array ([deliveryInfo] => Array ([address] => 98989 [deliveryStatus] => Submitted) [resourceURL] => http://api-otest.com/smsmessaging/1/outbound/OPNHSE/requests/urn:uuid:3b277b5b-cf79-4551-872f-16674499bc09/deliveryInfos) [senderAddress] => OPNHSE [outboundSMSTextMessage] => Array ([message] => sam has requested a payment of Rs 100.00 through payt.me . Kindly clickhttps://www.test.me/test to pay.) [clientCorrelator] => [receiptRequest] => Array ([notifyURL] => [callbackData] =>) [senderName] => [resourceURL] => http://api-test.com/smsmessaging/1/outbound/OPNHSE/requests/urn:uuid:3b277b5b-cf79-4551-872f-16674499bc09))
我得到這個。現在如何獲得deliveryStatus變量?
我試過,但即時得到一個PHP錯誤遇到 嚴重性:注意 消息:試圖讓非對象 文件名的屬性:控制器/衝刺。php 行號:138 – Piya
您需要知道如何調試代碼......首先,查看第138行,並用'print_r'檢查您嘗試訪問的對象。 –
你可以告訴我如何從他的asssociative array.i更新問題 – Piya