注意编码UTF8
$content = @file_get_contents("
if(empty($content)){ exit; }
$content=iconv('gb2312','utf-8', $content);
$xml = simplexml_load_string($content); $date = $xml->weather->forecast_information->forecast_date->attributes(); $html = $date. "
\r\n"; $current = $xml->weather->current_conditions;
$condition = $current->condition->attributes(); $temp_c = $current->temp_c->attributes(); $humidity = $current->humidity->attributes(); $icon = $current->icon->attributes(); $wind = $current->wind_condition->attributes();
$condition && $condition = $xml->weather->forecast_conditions->condition->attributes(); $icon && $icon = $xml->weather->forecast_conditions->icon->attributes(); $html="
{$temp_c}°C
\r\n";
$ssss=$xml->weather->forecast_conditions; $low = $ssss[0]->low->attributes(); $high = $ssss[0]->high->attributes(); $icon=$ssss[0]->icon->attributes(); $condition =$ssss[0]->condition->attributes(); $day_of_week = $ssss[0]->day_of_week->attributes(); $html.= "{$day_of_week} : {$high} / {$low} °C, {$condition}
\r\n";
$html=iconv('utf-8','gb2312', $html); print $html; ?>