PHP code example of tumobi / qqmap-region

1. Go to this page and download the library: Download tumobi/qqmap-region 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/ */

    

tumobi / qqmap-region example snippets


use Tumobi\QQMapRegion\Region;

$key = '你创建的 key';
$region = new Region($key);

$result = $region->getAllDistrict();
print_r($result);

// 北京市
$region_id = 110000;
$result = $region->getChildrenDistrict($region_id);
print_r($result);

$keyword = '香格里拉';
$result = $region->searchDistrict($keyword);
print_r($result);

$result = $region->getSelectorRegions();
print_r($result);


'region' => [
    'key' => env('REGION_KEY'),
],

public function edit(Region $region) 
{
    $districts = $region->getAllDistrict();
}

public function edit() 
{
    $districts = app('region')->getAllDistrict();
}