韩小韩Api

❤️  ❤️


接口地址:https://api.vvhan.com/api/weather

返回格式:json

请求方式:GET

请求示例(自动识别):https://api.vvhan.com/api/weather

请求示例(输出当天):https://api.vvhan.com/api/weather?city=徐州

请求示例(输出一周):https://api.vvhan.com/api/weather?city=徐州&type=week


请求参数说明:

名称 必填 类型 说明
city string 输入城市或县区

返回参数说明:

名称 类型 说明
code string 返回的状态码
msg string 返回错误提示信息!

返回参数说明:

{"data":{"yesterday":{"date":"30日星期三","high":"高温 4℃","fx":"西南风","low":"低温 -1℃","fl":"","type":"雨夹雪"},"city":"西安","forecast":[{"date":"31日星期四","high":"高温 7℃","fengli":"","low":"低温 -6℃","fengxiang":"西南风","type":"小雪"},{"date":"1日星期五","high":"高温 7℃","fengli":"","low":"低温 -4℃","fengxiang":"东北风","type":"多云"},{"date":"2日星期六","high":"高温 7℃","fengli":"","low":"低温 -3℃","fengxiang":"西南风","type":"多云"},{"date":"3日星期天","high":"高温 10℃","fengli":"","low":"低温 -1℃","fengxiang":"南风","type":"多云"},{"date":"4日星期一","high":"高温 8℃","fengli":"","low":"低温 -3℃","fengxiang":"东北风","type":"多云"}],"ganmao":"昼夜温差很大,易发生感冒,请注意适当增减衣服,加强自我防护避免感冒。","wendu":"2"},"status":1000,"desc":"OK"}

调用实例:

自行调用

示例代码:

<?php
header('Content-type:text/json;charset=utf-8;');
$city = $_GET['city'];
$result = file_get_contents("https://api.vvhan.com/api/weather?city=".$city);
echo $result;
?>