我正在嘗試從API解碼JSON響應(yīng),并將“serial_no”存儲(chǔ)為字符串,位于我的代碼下方,但我無法獲得預(yù)期的結(jié)果。我做錯(cuò)了什么嗎來自 API 的 JSON 響應(yīng) [ { "id": 20063, "transaction_date": "2020-01-24 10:41:031", "reference_id": "91", "voucher": [ { "serial_no": "KFCYQOqW23012024" } ] } ] 網(wǎng)絡(luò)工序代碼/* posting parameters to API */$post = wp_remote_post( $url, array( 'headers' => array( 'Content-Type' => 'application/x-www-form-urlencoded'), 'body' => $reserve_array ) );/*Decode JSON response to store in $serial */ $result = json_decode($post); $serial=$result[0]->voucher[0]->serial_no;
在wordpress中解碼來自API的JSON響應(yīng)
拉風(fēng)的咖菲貓
2022-08-19 10:43:16