Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/265.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 无法将javascript变量传递到Google Maps API_Php_Javascript_Maps - Fatal编程技术网

Php 无法将javascript变量传递到Google Maps API

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

我在php文件中使用以下代码

  <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
传递到位置