zoukankan      html  css  js  c++  java
  • guzzle 对接高德开放平台

            
            // 一般都是 其他数据 入库成功 后 才 更新 经纬度的
            //
    发起Http请求 $client = new Client(['timeout' => 5]); //得到URL地址 $url = config('gaode.geocode'); $city = City::findOrFail($fangInfo->fang_city); $url = sprintf($url, $fangInfo->fang_addr, $city->name); //发起请求 $response = $client->get($url); //可尝试 打印$response看看 $body = (string)$response->getBody(); $arr = json_decode($body, true); //如果找到了经纬度,存入数据表 if (count($arr['geocodes']) > 0) { $locationArr = explode(',', $arr['geocodes'][0]['location']); $fangInfo->update([ 'longitude' => $locationArr[0], 'latitude' => $locationArr[1] ]); }
  • 相关阅读:
    策略模式
    模板方法模式

    kafka
    Linux下部署MongoDB
    Linux下安装ssdb
    ssdb常用知识点
    Eclipse 的 Java Web 项目环境搭建
    PLSQL连接Oracle
    redis书籍
  • 原文地址:https://www.cnblogs.com/zqblog1314/p/12783262.html
Copyright © 2011-2022 走看看