中文字幕av专区_日韩电影在线播放_精品国产精品久久一区免费式_av在线免费观看网站

溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

php如何使用百度天氣接口

發布時間:2021-09-10 17:37:29 來源:億速云 閱讀:150 作者:chen 欄目:開發技術

本篇內容主要講解“php如何使用百度天氣接口”,感興趣的朋友不妨來看看。本文介紹的方法操作簡單快捷,實用性強。下面就讓小編來帶大家學習“php如何使用百度天氣接口”吧!

注意地區要轉碼的
百度ak申請地址:http://lbsyun.baidu.com/apiconsole/key

復制代碼 代碼如下:


<?php

$city="嘉興";
$content = file_get_contents("http://api.map.baidu.com/telematics/v3/weather?location=%E5%98%89%E5%85%B4&output=json&ak=5slgyqGDENN7Sy7pw29IUvrZ");
print_r(json_decode($content));

復制代碼 代碼如下:


{
    error: 0,
    status: "success",
    date: "2014-04-18",
    results: [
        {
            currentCity: "嘉興",
            weather_data: [
                {
                    date: "今天(周三)",
                    dayPictureUrl: "https://cache.yisu.com/upload/information/20201209/266/42918.png",
                    nightPictureUrl: "https://cache.yisu.com/upload/information/20201209/266/42919.png",
                    weather: "多云",
                    wind: "微風",
                    temperature: "23℃"
                },
                {
                    date: "明天(周四)",
                    dayPictureUrl: "https://cache.yisu.com/upload/information/20201209/266/42920.png",
                    nightPictureUrl: "https://cache.yisu.com/upload/information/20201209/266/42921.png",
                    weather: "雷陣雨轉中雨",
                    wind: "微風",
                    temperature: "29~22℃"
                },
                {
                    date: "后天(周五)",
                    dayPictureUrl: "https://cache.yisu.com/upload/information/20201209/266/42922.png",
                    nightPictureUrl: "https://cache.yisu.com/upload/information/20201209/266/42919.png",
                    weather: "陰轉多云",
                    wind: "微風",
                    temperature: "31~23℃"
                },
                {
                    date: "大后天(周六)",
                    dayPictureUrl: "https://cache.yisu.com/upload/information/20201209/266/42918.png",
                    nightPictureUrl: "https://cache.yisu.com/upload/information/20201209/266/42919.png",
                    weather: "多云",
                    wind: "微風",
                    temperature: "31~24℃"
                }
            ]
        },
        {
            currentCity: "合肥市",
            weather_data: [
                {
                    date: "今天(周三)",
                    dayPictureUrl: "https://cache.yisu.com/upload/information/20201209/266/42918.png",
                    nightPictureUrl: "https://cache.yisu.com/upload/information/20201209/266/42919.png",
                    weather: "多云",
                    wind: "東風3-4級",
                    temperature: "27℃"
                },
                {
                    date: "明天(周四)",
                    dayPictureUrl: "https://cache.yisu.com/upload/information/20201209/266/42918.png",
                    nightPictureUrl: "https://cache.yisu.com/upload/information/20201209/266/42919.png",
                    weather: "多云",
                    wind: "東北風3-4級",
                    temperature: "35~27℃"
                },
                {
                    date: "后天(周五)",
                    dayPictureUrl: "https://cache.yisu.com/upload/information/20201209/266/42918.png",
                    nightPictureUrl: "https://cache.yisu.com/upload/information/20201209/266/42919.png",
                    weather: "多云",
                    wind: "南風",
                    temperature: "35~27℃"
                },
                {
                    date: "大后天(周六)",
                    dayPictureUrl: "https://cache.yisu.com/upload/information/20201209/266/42918.png",
                    nightPictureUrl: "https://cache.yisu.com/upload/information/20201209/266/42919.png",
                    weather: "多云",
                    wind: "東風",
                    temperature: "34~27℃"
                }
            ]
        }
    ]
}

到此,相信大家對“php如何使用百度天氣接口”有了更深的了解,不妨來實際操作一番吧!這里是億速云網站,更多相關內容可以進入相關頻道進行查詢,關注我們,繼續學習!

向AI問一下細節

免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。

php
AI

濮阳县| 射阳县| 盖州市| 玉屏| 门源| 平和县| 伊宁市| SHOW| 剑阁县| 宜城市| 磴口县| 渭源县| 阳谷县| 清水县| 多伦县| 铜鼓县| 营山县| 涞源县| 周口市| 察雅县| 黔南| 宝鸡市| 凤山市| 锦州市| 清远市| 开平市| 连平县| 横峰县| 乌海市| 大邑县| 长葛市| 明溪县| 喀喇沁旗| 铁力市| 安平县| 宜兰市| 宾阳县| 尚志市| 通海县| 曲阜市| 扬州市|