简体   繁体   中英

Parse error: syntax error, unexpected $end in

I bring the code from google to correct it fit for my need The Code is fix lat long at the center of image i want to send variable to set up the center I send variable lat long but my code is error

line 45 is the code that i change maybe it is the problem please help

Parse error: syntax error, unexpected $end in /home/thaimayor/domains/thaimr.com/public_html/mapSisthorn/google/samuitet2.php on line 82

<?php // RAY_temp_teera.php
error_reporting(E_ALL);

// GET THE VARIABLES OR SET DEFAULT VALUES
$lat = (empty($_GET["lat"])) ? 0.0 : $_GET["lat"];
$lon = (empty($_GET["lon"])) ? 0.0 : $_GET["lon"];

// CREATE THE HTML STRING
$htm = <<<HTM
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
    <title>Google Maps AJAX + MySQL/PHP Example</title>
    <script src="http://maps.google.com/maps?file=api&v=2&key=ABQIAAAAwlTHfy96hHQkgNbKq5-RuBQagu-oIqMKXX4Fc4TvxpP4f1DXQhTXRsWbAuJyc9boRX8CpgPHemLS6w"
            type="text/javascript"></script>
    <script type="text/javascript">
    //<![CDATA[

    var iconBlue = new GIcon(); 
    iconBlue.image = 'http://labs.google.com/ridefinder/images/mm_20_blue.png';
    iconBlue.shadow = 'http://labs.google.com/ridefinder/images/mm_20_shadow.png';
    iconBlue.iconSize = new GSize(12, 20);
    iconBlue.shadowSize = new GSize(22, 20);
    iconBlue.iconAnchor = new GPoint(6, 20);
    iconBlue.infoWindowAnchor = new GPoint(5, 1);

    var iconRed = new GIcon(); 
    iconRed.image = 'http://labs.google.com/ridefinder/images/mm_20_red.png';
    iconRed.shadow = 'http://labs.google.com/ridefinder/images/mm_20_shadow.png';
    iconRed.iconSize = new GSize(12, 20);
    iconRed.shadowSize = new GSize(22, 20);
    iconRed.iconAnchor = new GPoint(6, 20);
    iconRed.infoWindowAnchor = new GPoint(5, 1);

    var customIcons = [];
    customIcons["restaurant"] = iconBlue;
    customIcons["bar"] = iconRed;

    function load() {
      if (GBrowserIsCompatible()) {
        var map = new GMap2(document.getElementById("map"));
        map.addControl(new GSmallMapControl());
        map.addControl(new GMapTypeControl());
        map.setCenter(new GLatLng($lat,$lon), 12);
        GDownloadUrl("phpsqlajax_genxml.php", function(data) { 
          var xml = GXml.parse(data);
          var markers = xml.documentElement.getElementsByTagName("marker");
          for (var i = 0; i < markers.length; i++) {
            var name = markers[i].getAttribute("name");
            var address = markers[i].getAttribute("address");
            var type = markers[i].getAttribute("type");
            var picname = markers[i].getAttribute("picname");
            var point = new GLatLng(parseFloat(markers[i].getAttribute("lat")),
                                    parseFloat(markers[i].getAttribute("lng")));
            var marker = createMarker(point, name, address, type, picname);
            map.addOverlay(marker);
          }
        });
      }
    }


      function createMarker(point, name, address, type, picname) {
      var marker = new GMarker(point, customIcons[type]);
      var html = "<b>" + name + "</b> <br/>" + address+"<br /><img src='"+picname+"' />";
      GEvent.addListener(marker, 'click', function() {
        marker.openInfoWindowHtml(html);
      });
      return marker;



    }
    //]]>
  </script>
  </head>

  <body onload="load()" onunload="GUnload()">
    <div id="map" style="width: 800px; height: 600px"></div>
  </body>
</html>

You've forgotten the closing

HTM;

at the end of your HEREDOC. You can't omit that, just as you can't omit a closing } . The only closing tag you can omit in PHP is ?> .

You are using a HEREDOC , without a closing marker.

You should add, to the end of your file (likely):

HTM;
echo $htm;

您只是错过了最后一行。

HTM;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM