tianqiapiAdapter.php 455 B

123456789101112131415161718192021222324
  1. <?php
  2. namespace Heanup\Library\WeatherAdapt;
  3. class tianqiapiAdapter implements Weather
  4. {
  5. public function __construct()
  6. {
  7. }
  8. public function getWeatherData($city_id)
  9. {
  10. $data=file_get_contents(sprintf("https://www.tianqiapi.com/api/?version=v1&cityid=%s", $city_id));
  11. return json_decode($data,true);
  12. }
  13. public function parseData($data1, $data2)
  14. {
  15. // TODO: 需要实现 parseData() 方法.
  16. }
  17. }