我有这个源文件。
[
{
"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." ";
}