其實這是一個字符串,字符串數組或對象
我怎樣才能將它轉換爲對象或數組..
{"kind": "delivery_quote", "fee": 750, "created": "2016-02-28T19:13:38Z", "expires": "2016-02-28T19:18:38Z", "currency": "usd", "duration": 60, "dropoff_eta": "2016-02-28T20:18:38Z", "id": "dqt_KhC5sbjq00Jn6F"}
我想這
$array=explode(' ',$result);
$json = json_encode($result);
print($json);
它給我像這樣的結果
"{\"kind\": \"delivery_quote\", \"fee\": 750, \"created\": \"2016-02-28T19:13:38Z\", \"expires\": \"2016-02-28T19:18:38Z\", \"currency\": \"usd\", \"duration\": 60, \"dropoff_eta\": \"2016-02-28T20:18:38Z\", \"id\": \"dqt_KhC5sbjq00Jn6F\"}"
B UT我怎麼能做到這一點正確,這樣我可以把結果就像
echo $json->fee;
這裏是什麼我到目前爲止的Eval。
幫助請
與嘗試'json_decode' – roullie
你試過'json_decode '? –
http://php.net/manual/en/function.json-decode.php –