定制 walker-distance/weather 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

walker-distance/weather

Composer 安装命令:

composer require walker-distance/weather

包简介

Package description here.

README 文档

README

.

Installing

$ composer require walker-distance/weather -vvv

Usage

发布配置文件

php artisan vendor:publish --provider='WalkerDistance\Weather\ServiceProvider'

针对laravel5.5版本使用

更新env文件(:API_KEY 高德对应应用的KEY)

WEATHER_API_KEY=*******************

使用方法(一)

$city = '北京';
$type = 'all'; //可以不填 默认为实时天气  all表示天气预报
$format = 'json'; //默认为json  支持xml(json) 
app('weather')->getweather($city, $type = null, $format = null);

使用方法(二)

//在laravel中使用
protected $weather;

public function __construct(Weather $weather)
{
    $this->weather = $weather;
}

//在方法中使用
public function getWeather(Request $request)
{
    //$city = '北京';
    //$type = 'all'; //可以不填 默认为实时天气  all表示天气预报
    //$format = 'json'; //默认为json  支持xml(json) 
    $city = $request->get('city');
    $response = $this->weather->getWeather($city ?: '北京');
    return $this->success($response);
}

使用方法(三)

//$city = '北京';
//$type = 'all'; //可以不填 默认为实时天气  all表示天气预报
//$format = 'json'; //默认为json  支持xml(json) 
$city = '天津';
$key = '';
$weather = new Weather($key);
$response = $weather->getWeather($city,$type = null,$format = null);

参考

高德开放平台天气接口 https://lbs.amap.com/api/webservice/guide/api/weatherinfo/

统计信息

  • 总下载量: 6
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2020-06-19

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固