上海天气预报7天 (上海天气预报60天查询百度)
上海品茶
08-03
阅读:3
评论:18
![](/gg/hf11.gif)
接下来 7 天天气预报
(.?)<\/div>/s', $html, $matches);$dates = $matches[1]; $days = $matches[2]; $months = $matches[3]; $weathers = $matches[4];// 遍历天气预报数据,生成 HTML 表格 for ($i = 0; $i < count($dates); $i++) {$date = $dates[$i];$day = $days[$i];$month = $months[$i];$weather = $weathers[$i];// 解析出天气状况、气温和风向风速preg_match('/ (.?)<\/span>/', $weather, $weather_matches);preg_match('/(.?)<\/p>/', $weather, $temperature_matches);preg_match('/
(.?)<\/p>/', $weather, $wind_matches);// 解析出湿度preg_match('/
日期 | 天气 | 气温 | 风向风速 | 湿度 |
---|---|---|---|---|
{$month}-{$day}-{$date} | {$weather_matches[1]} | {$temperature_matches[1]} | {$wind_matches[1]} | {$humidity_matches[1]} |
60 天天气预报查询
请访问以下链接查询上海未来 60 天的天气预报: 上海天气预报60天查询百度
版权声明
本文仅代表作者观点,不代表上海桑拿立场。
本文系作者授权发表,未经许可,不得转载。