扫码关注官方订阅号
http://git.oschina.net/startbbs/startbbs/graph/master.json
这里是一段json数据,想获取message的值,循环出来。如何弄。 先转成数组,对吧
闭关修行中......
<?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); ?>
用curl取得url里的json值,再json_decode得到数组$arr,循环$arr['commits']得到message的值
微信扫码关注PHP中文网服务号
QQ扫码加入技术交流群
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
PHP学习
技术支持
返回顶部
用curl取得url里的json值,再json_decode得到数组$arr,循环$arr['commits']得到message的值