nyeholt / silverstripe-weatherforecast
获取天气预报(使用openweather服务)
dev-master / 1.0.x-dev
2016-07-20 07:19 UTC
Requires
- silverstripe/framework: ~3.1
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 的要求意味着你必须在网站上提供对该服务的说明。