PHP code example of her-cat / baidu-map

1. Go to this page and download the library: Download her-cat/baidu-map library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

her-cat / baidu-map example snippets




use HerCat\BaiduMap\Factory;

$config = [
    'ak' => 'your ak',
//    'sk' => 'your sk',
    'log' => [
        'file' => './baidu-map.log'
    ],
    'response_type' => 'array',
];

$webApi = Factory::webApi($config);

$result = $webApi->timezone->get('116.30815', '40.056878');

//    Array
//    (
//        [status] => 0
//        [timezone_id] => Asia/Shanghai
//        [dst_offset] => 0
//        [raw_offset] => 28800
//    )