graychen / geolocation
Get the geographic location based on latitude and longitude
Installs: 1 496
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 2
Forks: 0
Open Issues: 0
Requires
- league/container: dev-master
- psr/container: ^1.0@dev
Requires (Dev)
- bamboohr/phpcs: dev-master
- phpunit/phpunit: ^6.2
This package is not auto-updated.
Last update: 2024-11-10 04:17:26 UTC
README
composer包 根据经纬度得到地理位置信息,暂时还只有baidu地图api接口
this is a library for find address by geolocation
how to use
<?php namespace graychen\Tests; use PHPUnit\Framework\TestCase; use graychen\geolocation\BaiduGeolocation; class BaiduGeolocationTest extends TestCase { private $geolocation; public function setUp() { $this->geolocation=new BaiduGeolocation(); } /** * Asserts that the container can set and get a simple closure with args. */ public function testGetgeolocation() { $this->geolocation->latitude= "your latitude"; $this->geolocation->longitude= "your longitude"; $this->geolocation->ak= "your ak"; $json_content=$this->geolocation->getGeolocation(); $province=$json_content["result"]["addressComponent"]["province"]; $this->assertEquals("江苏省", $province); } }