我有关于RSS雅虎天气预报的问题。
我的案例:如何在rss雅虎天气预报中获取temp?
我的代码:I循环:
$current = $item->xpath('yweather:condition');<br>
$forecast = $item->xpath('yweather:forecast');<br>
end loop
{$forecast[0]['day']} - {$forecast[0]['date']} - {$forecast[0]['text']}. High: {$forecast[0]['high']} Low: {$forecast[0]['low']} || Code :{$forecast[0]['code']}但是对于{$forecast[0]['temp']}是行不通的。
发布于 2015-05-28 17:50:31
在Yahoo Forecast上,"temp“标签只显示当天的数据。
<yweather:condition text="Mostly Cloudy" code="26" temp="57" date="Tue, 29 Nov 2005 3:56
pm PST"></yweather:condition>您应该将此代码更改为显示当前温度:
{$current[0]['temp']}另外,如果你想显示即将到来的一天的温度,你应该只使用“高”和“低”标签。检查示例:
<yweather:forecast day="Tue" date="29 Nov 2005" low="45" high="62" text="Mostly Cloudy"
code="27"></yweather:forecast>
<yweather:forecast day="Wed" date="30 Nov 2005" low="52" high="60" text="Mostly Cloudy"
code="28"></yweather:forecast>https://stackoverflow.com/questions/30502624
复制相似问题