私はこのソースファイルを持っています。
[
{
"title": "Course1",
"location": "BuildingA",
"day": "wednesday",
"id": 85412
},
{
"title": "Course2",
"location": "BuidlingB",
"day": "friday",
"id": 85413
},
{
"title": "Course3",
"location": "BuidlingA",
"day": "friday",
"id": 85414
}
]
PHPで、キー「title」と「location」の値のみを出力するにはどうすればよいですか?
私がこれまでに持っているコードは次のとおりです。
$array = json_decode($json, true);
foreach ($array as $key => $jsons) {
foreach($jsons as $key => $value)
echo $value." ";
}