0

I would like to have the data returned from mtgapi to be placed into an array of associative keys and values.

Sample output can be found at http://mtgapi.com/docs.

As the output is returned as a string, I pull it into PHP as a string using file_get_contents($url);

Edit: I did not know the return is a JSON object! Simple!

4

1 回答 1

1

它返回一个 JSON 对象。你应该使用json_decode.

尝试:

$json = file_get_contents($url);
var_dump(json_decode($json, true));

资源

于 2013-11-07T14:36:53.093 回答