nyeholt/silverstripe-weatherforecast

获取天气预报(使用openweather服务)

安装次数: 4,160

依赖关系: 0

建议者: 0

安全性: 0

星标: 0

关注者: 1

分支: 3

开放问题: 0

语言:HTML

类型:silverstripe模块

dev-master / 1.0.x-dev 2016-07-20 07:19 UTC

This package is auto-updated.

Last update: 2024-08-29 03:57:02 UTC


README

使用方法

在你的项目 .yml 配置文件中

---
Name: weather-config
After: weatherforecast/*
---
Injector:
  OpenWeatherService:
    properties:
      key: {your key here}

从你的代码中,调用以下代码。LocationID 需要从 openweather 网站查询。

Requirements::css('weatherforecast/owfonts/css/owfont-regular.min.css');
$forecast = singleton('OpenWeatherService')->forecastFor($locationID);

请注意

OpenWeatherMaps 的要求意味着你必须在网站上提供对该服务的说明。