将mtgapi的响应解析为关联数组

时间:2013-11-07 14:34:34

标签: php arrays json associative-array explode

我希望将mtgapi返回的数据放入一个关联键和值数组中。

可以在http://mtgapi.com/docs找到示例输出。

当输出作为字符串返回时,我使用file_get_contents($url);

将其作为字符串拉入PHP

编辑: 我不知道return是一个JSON对象!简单!

1 个答案:

答案 0 :(得分:1)

它正在返回一个JSON对象。您应该使用json_decode

尝试:

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

source