![](/gg/hf11.gif)
$this->get_weather($content),'temperature' => $this->get_temperature($content),'wind' => $this->get_wind($content),'humidity' => $this->get_humidity($content));}// 3、输出天气数据echo '';echo '';foreach ($weather_data as $day => $data) {echo '';echo '';echo '';echo '';echo '';echo '';echo '';}echo '
日期
|
天气
|
温度
|
风向风力
|
湿度
|
'.$day.'
|
'.$data['weather'].'
|
'.$data['temperature'].'
|
'.$data['wind'].'
|
'.$data['humidity'].'
|
';// 获取天气function get_weather($content) {$pattern = '/
(.?)<\/span>/is';preg_match($pattern, $content, $matches);return $matches[1];}// 获取温度function get_temperature($content) {$pattern = '/
(.?)<\/span>/is';preg_match($pattern, $content, $matches);return $matches[1];}// 获取风向风力function get_wind($content) {$pattern = '/
(.?)<\/span>/is';preg_match($pattern, $content, $matches);return $matches[1];}// 获取湿度function get_humidity($content) {$pattern = '/
(.?)<\/span>/is';preg_match($pattern, $content, $matches);return $matches[1];}?>