PHP code example of yupoxiong / region

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

    

yupoxiong / region example snippets


Route::group('region',function (){
    Route::any('getRegion','\yupoxiong\region\RegionController@getRegion');
    Route::any('getProvince','\yupoxiong\region\RegionController@getProvince');
    Route::any('getCity','\yupoxiong\region\RegionController@getCity');
    Route::any('getDistrict','\yupoxiong\region\RegionController@getDistrict');
    Route::any('getStreet','\yupoxiong\region\RegionController@getStreet');
    Route::any('searchRegion','\yupoxiong\region\RegionController@searchRegion');
    Route::any('searchProvince','\yupoxiong\region\RegionController@searchProvince');
    Route::any('searchCity','\yupoxiong\region\RegionController@searchCity');
    Route::any('searchDistrict','\yupoxiong\region\RegionController@searchDistrict');
    Route::any('searchStreet','\yupoxiong\region\RegionController@searchStreet');
});

//获取省市区街道缓存、查询字段配置
'region' => [
    //查询缓存秒数,false为不缓存
    'cache' => 20140210,
    //查询字段,可选项:id,name,parent_id,initial,pinyin,citycode,adcode,lng_lat
    'field' => 'id,name',
    //排序,默认为adcode正序
    'order' => 'adcode asc',
]
    

\yupoxiong\region\facade\Region::getProvince();
//更多可参考该类

php think region:publish

php think region:migrate

php think region:migrate

php think region:publish