我想在 PHP 中解析以下一堆 JSON 对象。但在某种程度上,这是行不通的。
[
{"latitute":16.8045558404827,"longitude":36.9140487536788,
"missionid":0,"status":0,"waypointid":0},
{"latitute":-14.093939943107658,"longitude":21.093734242022038,
"missionid":0,"status":0,"waypointid":0}
]
.
$obj = json_decode($_POST["waypoints"]);
foreach ($json->items as $item) {
echo($item->{'longitude'});
echo($item->{'latitude'});
echo($item->{'missionid'});
$query="INSERT INTO dio.wpoint (longitude, latitude, missionid, status, ) VALUES ("$item->{'longitude'}.","$item->{'latitude'}.",41)";
mysql_query($query);
}