PHP query to obtain detailed information of longitude and latitude-Tencent Map

My usage scenario here is to verify whether the selected longitude and latitude belong to the specified province or city.
Get the area code for comparison
  1. Encapsulated query class
<?php

namespace app\common\library;

/**
 * @name: 经纬度查询类
 * @author: Turbo
 * @Date: 2022-09-20 10:44:36
 */
class SelectLngLatData
{
   
    
    
    protected static $instance;
    /**
     * @var array 配置
     */
    protected $option = [];
    /**
     * @var int 当前时间
     */
    protected $time = 0;
    /**
     * @var string 错误信息
     */
    protected $errorMessage = '';

    public function __construct($lng = 0, $lat = 0)
    {
   
    
    
        $this->time = time();
        $this->option['lng'] = $lng;
        $this->option['lat'] = $lat;
    }

    private function __clone()
    {
   
    
    
        // TODO: Implement __clone() method.
    }

    /**
     * 初始化
     * @param str $lng 经度
     * @param str $lat 纬度
     * @return SelectLngLatData
     */
    public static function instance($lng = 0, $lat = 0)
    {
   
    
    
        if (is_null

Guess you like

Origin blog.csdn.net/qq_15957557/article/details/126953749