Test.php 569 字节
<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2020/5/8
 * Time: 9:30
 */

namespace app\index\controller;


use app\common\controller\HomeBase;
use function EasyWeChat\Payment\get_client_ip;
use fast\Http;

class Test extends HomeBase
{
    public function index(){
        $ip = request()->ip(0, false);
        $url = "http://api.map.baidu.com/location/ip?ak=lu7CH9ucr6STjUk1GQgkfzjhpHbb7hPd&ip=$ip&coor=bd09ll";
        $data = Http::get($url);
        $data = json_decode($data,true);
        return $data;
        return $this->fetch();
    }
}