cosyphp/weather

天气SDK。

0.0.3 2019-02-12 10:39 UTC

This package is auto-updated.

Last update: 2024-09-12 23:22:53 UTC


README

天气SDK...

安装

$ composer require cosyphp/weather -vvv

使用

<?php

require __DIR__ .'/vendor/autoload.php';

use Cosyphp\Weather\Weather;

$key = 'a775cc62fc87a9d0d9106d63b9397d41';

$w = new Weather($key);

echo "获取实时天气:\n";

$response = $w->getWeather('郑州');

echo json_encode($response, JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT);

echo "\n\n获取天气预报:\n";

$response = $w->getWeather('郑州', 'all');
echo json_encode($response, JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT);

echo "\n\n获取实时天气(XML):\n";

echo $w->getWeather('深圳', 'base', 'XML');

贡献

你可以通过以下三种方式之一进行贡献

  1. 使用问题跟踪器提交错误报告。
  2. 问题跟踪器上回答问题或修复错误。
  3. 贡献新功能或更新wiki。

代码贡献过程并不非常正式。你只需确保遵循PSR-0、PSR-1和PSR-2编码规范。任何新的代码贡献都必须附带适用的单元测试。

许可证

MIT