如何从PHP中读取这种类型的JSON文件[JSON results from open alpr]?

如何从PHP中读取这种类型的JSON文件[JSON results from open alpr]?,php,json,jsonp,openalpr,alpr,Php,Json,Jsonp,Openalpr,Alpr,我需要知道如何提取JSON数据,如下面发布到php的JSON格式,我正在尝试使用php脚本将以下JSON文件键值数据提取到mysql。以下JSON来自openalpr,使用命令行上的alpr导出为JSON 我一直得到的是这样的错误非法字符串偏移量”结果 我测试的显示车牌号的php代码: 有人能帮助指导我如何使用PHP脚本在json数组中获取子数组的值吗? 多谢各位** 我使用了以下代码,不确定关于子元素的键值的错误是什么 $filename = "results.json";

我需要知道如何提取JSON数据,如下面发布到php的JSON格式,我正在尝试使用php脚本将以下JSON文件键值数据提取到mysql。以下JSON来自openalpr,使用命令行上的alpr导出为JSON

我一直得到的是这样的错误
非法字符串偏移量”结果
我测试的显示车牌号的php代码:
有人能帮助指导我如何使用PHP脚本在json数组中获取子数组的值吗? 多谢各位**

我使用了以下代码,不确定关于子元素的键值的错误是什么

$filename = "results.json";
          $data = file_get_contents($filename); //Read the JSON file in PHP
          $array = json_decode($data, true); //Convert JSON String into PHP Array
          
          foreach ($data['results']['results'] AS $d)
          {
            echo $d['plate'];
            }

您的json字符串错误,第一行缺少{

$json=”
{
“版本”:2,
“数据类型”:“alpr结果”,
“大纪元时间”:1594858871000,
“img_宽度”:3232,
“img_高度”:3232,
“处理时间”:522.5,
“感兴趣区域”:[],
“结果”:[
{
“标牌”:“QAA1989C”,
“信心”:90.09095,
“匹配_模板”:0,
“板块指数”:0,
“区域”:“我的”,
“区域置信度”:0,
“处理时间”:42.125999,
“请求的主题”:10,
“坐标”:[
{
“x”:1149,
“y”:2071
},
{
“x”:1836年,
“y”:2071
},
{
“x”:1836年,
“y”:2268
},
{
“x”:1149,
“y”:2268
}
]
}
]
}
';
$data=json_decode($json,true);
foreach($data['results']作为$d){
echo$d[‘盘子’];
}

使用json\u decode我添加了json\u decode,但json键值格式有点不一致,无法将值提取到PHP数组。我将遇到非法字符串偏移量“plate”的问题
$filename = "results.json";
          $data = file_get_contents($filename); //Read the JSON file in PHP
          $array = json_decode($data, true); //Convert JSON String into PHP Array
          
          foreach ($data['results']['results'] AS $d)
          {
            echo $d['plate'];
            }