上海发布天气预报15天 (上海发布天气预警)
当前天气
温度: " . $currentWeather->current->temp_c . "°C "; echo "体感温度: " . $currentWeather->current->feelslike_c . "°C
"; echo "天气状况: " . $currentWeather->current->condition->text . "
"; echo "风速: " . $currentWeather->current->wind_kph . "公里/小时
"; echo "湿度: " . $currentWeather->current->humidity . "%
"; ?>15天预报
"; foreach ($forecast->forecast->forecastday as $day) {echo "最高温度: " . $day->day->maxtemp_c . "°C
";echo "最低温度: " . $day->day->mintemp_c . "°C
";echo "天气状况: " . $day->day->condition->text . "
";echo "风速: " . $day->day->maxwind_kph . "公里/小时
";echo "湿度: " . $day->day->avghumidity . "%
";echo ""; } echo ""; ?>
天气预警
alerts) > 0) {echo "当前存在天气预警:
";echo "-
";foreach ($alerts->alerts as $alert) {echo "
- " . $alert->event . " ";echo "
生效时间: " . $alert->start . "
";echo "失效时间: " . $alert->end . "
";echo "严重程度: " . $alert->severity . "
";echo "";}echo "
目前没有天气预警。
"; } ?>版权声明
本文仅代表作者观点,不代表上海桑拿立场。
本文系作者授权发表,未经许可,不得转载。