【发布时间】:2017-04-04 14:11:39
【问题描述】:
我在 @attributes 中拥有所有 JSON 数据,并希望使用 PHP 将其提取到变量中。
我正在尝试什么:
$url = "http://synd.cricbuzz.com/j2me/1.0/livematches.xml";
$xml = simplexml_load_file($url) or die("Error..");
$json = json_encode($xml, JSON_PRETTY_PRINT);
$decode_json = json_decode($json);
$match = $decode_json->match[0];
print_r($match);
这是我使用上述代码得到的输出:http://phpfiddle.org/main/code/3zbq-62w0
任何帮助将不胜感激。谢谢..
【问题讨论】:
-
可以将结果转为数组,然后使用数组