Php 无法将javascript变量传递到Google Maps API
我在php文件中使用以下代码Php 无法将javascript变量传递到Google Maps API,php,javascript,maps,Php,Javascript,Maps,我在php文件中使用以下代码 <script> var geocoder = new google.maps.Geocoder(); geocoder.geocode( {'address': '<?php echo $element['singleCoords']; ?>' }, function(results, status) { if (status == google.m
<script>
var geocoder = new google.maps.Geocoder();
geocoder.geocode( {'address': '<?php echo $element['singleCoords']; ?>' },
function(results, status) {
if (status == google.maps.GeocoderStatus.OK) {
firstLoc = results[0].geometry.location;
var gmap<?php echo $element['id']; ?>_marker = new google.maps.Marker({
position: new google.maps.LatLng(firstLoc)
但我想看看这个:
new google.maps.LatLng(firstLoc)
new google.maps.LatLng(5.34.., 5,6...).
我做错了什么?是否需要将该位置设置为车床坐标 根据需要,您只需将
结果[0].几何体.location
传递到位置