Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/441.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
Javascript codeignite中未显示地图_Javascript_Php_Codeigniter_Google Maps Api 3 - Fatal编程技术网

Javascript codeignite中未显示地图

Javascript codeignite中未显示地图,javascript,php,codeigniter,google-maps-api-3,Javascript,Php,Codeigniter,Google Maps Api 3,我实际上为我的站点集成了谷歌地图,但地图并没有显示,我使用了谷歌地图库,但仍然并没有显示。 这是我的密码: 控制器: <?php class api extends CI_Controller { public function index() { parent::Controller(); } function googleapi() { $this->load->library('goo

我实际上为我的站点集成了谷歌地图,但地图并没有显示,我使用了谷歌地图库,但仍然并没有显示。 这是我的密码:

控制器:

<?php 
 class api extends CI_Controller
 {
     public function index()
     {
         parent::Controller();
     }

    function googleapi()
    {
        $this->load->library('googlemaps');
        $config = array();
$config['zoom'] = 'auto';
$config['geocodeCaching'] = TRUE;
$config['region'] = 'US';
$config['sensor'] = FALSE;
$this->googlemaps->create($config);

$markers = array();
$marker['position'] = '37.429, -122.1519';
$marker['animation'] = 'DROP';
$this->googlemaps->add_markers($markers);

$markers = array();
$marker['position'] = '1600 Amphitheatre Parkway in Mountain View, Santa Clara County, California United States';
$marker['animation'] = 'DROP';
$this->googlemaps->add_markers($markers);

$data['map'] = $this->googlemaps->create();

echo print_r($data['map']['markers']);
    }
 }
?>

如果我的代码中有错误,请帮助我。谢谢你

试着这样做:

控制器文件:

$this->load->library('googlemaps');

$config['center'] = '37.4419, -122.1419';
$config['zoom'] = 'auto';
$this->googlemaps->initialize($config);

$marker = array();
$marker['position'] = '37.429, -122.1419';
$this->googlemaps->add_marker($marker);
$data['map'] = $this->googlemaps->create_map();

$this->load->view('view_file', $data);
查看文件:

<html>
<head><?php echo $map['js']; ?></head>
<body><?php echo $map['html']; ?></body>
</html>