http://git.oschina.net/startbbs/startbbs/graph/master.json
这里是一段json数据,想获取message的值,循环出来。如何弄。 先转成数组,对吧
ringa_lee2017-04-10 14:36:40
<?php
$message = array();
$json = json_decode(
file_get_contents('http://git.oschina.net/startbbs/startbbs/graph/master.json'),
true);
foreach($json['commits'] as $commit)
$message[] = $commit['message'];
print_r($message);
?>
伊谢尔伦2017-04-10 14:36:40
<?php
$message = array();
$json = json_decode(
file_get_contents('http://git.oschina.net/startbbs/startbbs/graph/master.json'),
true);
foreach($json['commits'] as $commit)
$message[] = $commit['message'];
print_r($message);
?>