如何提取json
{"scoreboard":{"lastUpdatedOn":"2017-08-21 6:58:49 PM","gameScore":[{"game":{"ID":"40380","week":"1","scheduleStatus":"Normal","originalDate":null,"originalTime":null,"delayedOrPostponedReason":null,"date":"2017-09-11","time":"7:10PM","awayTeam":{"ID":"70","City":"New Orleans","Name":"Saints","Abbreviation":"NO"},"homeTeam":{"ID":"63","City":"Minnesota","Name":"Vikings","Abbreviation":"MIN"},"location":"TCF Bank Stadium"},"isUnplayed":"true","isInProgress":"false","isCompleted":"false","quarterSummary":null}
如何通过php
提取上面的json$allnfls = $nfls['scoreboard']['gameScore'];
foreach($allnfls as $allnfl)
{
//foreach($allnfld as $allnfl) {
$gameid = $allnfl['ID'];
echo "<br>".$week = $allnfl['game']['week'];
}
答案 0 :(得分:0)
定义变量并使用json_decode(YourJSONString,true)