dqm4675 2016-04-06 07:06
浏览 90

laravel项目中的谷歌地图

I am workin on laravel project in which i have to integrate google maps. I am using this package https://github.com/alexpechkarev/google-maps for google maps . I install this package and get api key from https://console.developers.google.com/apis/credentials . then I just follow the usage of this package for example i write the code in my controller

$response = \GoogleMaps::load('geocoding')
        ->setParam (['address' =>'santa cruz'])
        ->get();

It giving me data in json encode formate but i dont't know what i do next . How can i display maps . can someone please give me proper example of this package via code i will be thankfull for that thanks in advanced

  • 写回答

1条回答 默认 最新

  • doubaoxue5788 2016-04-06 13:19
    关注

    You need to actually implement the map on the front end in your views:

    <div id="map"></div>
    <script src="https://maps.googleapis.com/maps/api/js" async defer></script>
    
    <script>
      function initMap() {}
    </script>
    

    Read this: https://developers.google.com/maps/tutorials/fundamentals/adding-a-google-map#introduction

    评论

报告相同问题?