php - 访问嵌套 JSON 参数
问题描述
我试图从 JSON 数组中获取 Vin 部分。
{
"results": [
{
"vehicle": {
"ownershipCondition": "Used",
"registration": "BX68NHL",
"vin": "ZFA3120000JA60541",
"make": "Fiat",
"model": "500",
"generation": "Hatchback (2015 - )"
}
}
]
}
我尝试过使用它,但它不起作用。任何人都可以帮忙。
foreach($result['results'] as $res)
{
$currCar = $res['vehicle']['vin'];
echo $currCar."\n";
}
解决方案
推荐阅读
- python - 使用 python selenium 查找组件时遇到问题
- javascript - JavaScript:函数 - 如何激活取消按钮
- android - 导航组件:如何列出返回栈上的片段?
- netsuite - 如何在 netsuite 中使用 portlet 脚本类型(SuiteScript 2.0)显示饼图?以及如何在我们的 portlet 脚本中包含 HTML 文件。
- c++ - 在具有可变参数模板的基于模板的类中完美转发?
- git - 在 git 存储库中维护相同自述文件的两个副本
- python - Matplotlib x 轴上的毫秒刻度
- android - 在 RecyclerView OnItemClickListener 上显示对话框
- flutter - 如何将下载的数据从 API 保存到 Flutter 中的 RAM?
- python - Django 自动建模多对多关系添加