Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/codeigniter/3.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 使用biostall map v3库使用codeigniter查看google places api中添加的位置_Php_Codeigniter_Google Places Api - Fatal编程技术网

Php 使用biostall map v3库使用codeigniter查看google places api中添加的位置

Php 使用biostall map v3库使用codeigniter查看google places api中添加的位置,php,codeigniter,google-places-api,Php,Codeigniter,Google Places Api,首先,我在GooglePlacesAPI中添加了一些地方,并使用以下代码片段 <?php class PlaceAdd Extends CI_controller{ public function index(){ $this->load->model('placeAdd_model'); $a = $this->placeAdd_model->getAtm(); foreach($a as $k){

首先,我在GooglePlacesAPI中添加了一些地方,并使用以下代码片段

<?php
class PlaceAdd Extends CI_controller{
    public function index(){
        $this->load->model('placeAdd_model');
        $a = $this->placeAdd_model->getAtm();

        foreach($a as $k){

        $jsonpost = '{
                  "location": {
                    "lat": '.$k['Latitude'].',
                    "lng": '.$k['Longitude'].'
                  },
                  "accuracy": 50,
                  "name": "'.$k['ATMName'].'",
                  "phone_number": "'.$k['PriorityMobile'].'",
                  "address": "'.$k['AddressLine1'].'",
                  "types": ["atm"],
                  "website": "http://www.google.com.bd/",
                  "language": "en"
                }';

       $url = "https://maps.googleapis.com/maps/api/place/add/json?key={my api key}";

      $results = $this->ProcessCurl ($url, $jsonpost);
      $data = json_decode($results);
      print_r($data);
    }
  }
}
是写在代码段下面的,添加数据是因为我在添加数据后收到一个状态:“OK”,并且我还可以通过点击以下URL查看添加数据的信息

假设我的数据库中有100个ATM信息,我已经将所有ATM信息添加到Google的数据库中,并且所有数据都在我的API密钥下

现在我想一次查看我在API密钥下添加的所有数据(100 ATM信息)

我还尝试了CodeIgniter Google Maps V3 API库

我所做的是:

<?php

if (!defined('BASEPATH'))
    exit('No direct script access allowed');

class ViewPlaces extends CI_Controller {

public function __construct() {
    parent::__construct();
    $this->load->helper('url');
    $this->load->library('Googlemaps');
}

public function index(){
    $config['center'] = '23.790960, 90.404426';
    $config['zoom'] = 'auto';
    $config['places'] = TRUE;
    $config['placesLocation'] = '23.790960, 90.404426';
    $config['placesRadius'] = 50; 
    $this->googlemaps->initialize($config);
    $data['map'] = $this->googlemaps->create_map();
    $this->load->view('map_view', $data);
  }
}

你在biostall中提到你的API密钥了吗?是的,我在“谷歌地图”库@MurtazaHussain中插入了我的API密钥这是原始库文件,库中有一行(第23行)
var$apiKey='{my API key}'//如果你有一个API密钥,你可以通过传递这个参数来使用它。在此处设置API密钥:https://code.google.com/apis/console
我把API密钥放在这里,期待您的帮助。。。。你能吗@穆塔扎侯赛因
<?php

if (!defined('BASEPATH'))
    exit('No direct script access allowed');

class ViewPlaces extends CI_Controller {

public function __construct() {
    parent::__construct();
    $this->load->helper('url');
    $this->load->library('Googlemaps');
}

public function index(){
    $config['center'] = '23.790960, 90.404426';
    $config['zoom'] = 'auto';
    $config['places'] = TRUE;
    $config['placesLocation'] = '23.790960, 90.404426';
    $config['placesRadius'] = 50; 
    $this->googlemaps->initialize($config);
    $data['map'] = $this->googlemaps->create_map();
    $this->load->view('map_view', $data);
  }
}