我需要将latlngs
值输入locations
之类的内容:
var locations = [
['Bondi Beach', -33.890542, 151.274856],
['Coogee Beach', -33.923036, 151.259052],
['Cronulla Beach', -34.028249, 151.157507]
['Manly Beach', -33.80010128657071, 151.28747820854187],
['Maroubra Beach', -33.950198, 151.259302]
];
这是我的PHP代码:
$result = $conn->query("select address, lat, lang from user where phoneno = '" . $phoneno. "'");
$outp = "[";
while($rs = $result->fetch_array(MYSQLI_ASSOC)) {
if ($outp != "[") {$outp .= ",";}
$outp .= '{"address":' . $rs["address"] . ',';
$outp .= '"lat":"' . $rs["lat"] . '",';
$outp .= '"lang":"' . $rs["lang"] . '"}';
}
$outp .="]";
这是url中的值输出:
[{"address":Tampines Street 86,
Singapore,"lat":"1.3498584","lang":"103.9273744"}]