Php 将数组转换为列表格式
如何修改此xml数据以列表格式显示Php 将数组转换为列表格式,php,html,xml,Php,Html,Xml,如何修改此xml数据以列表格式显示 foreach ($dataArray['simpleforecast']['forecastday'] as $arr) { $html .= "<td align='center'>" . $arr['date']['weekday'] . "<br />"; $html .= "<img src='http://icons-pe.wxug.com/i/c/a/" . $arr['icon'] . ".gif'
foreach ($dataArray['simpleforecast']['forecastday'] as $arr) {
$html .= "<td align='center'>" . $arr['date']['weekday'] . "<br />";
$html .= "<img src='http://icons-pe.wxug.com/i/c/a/" . $arr['icon'] . ".gif' border=0 /><br />";
$html .= "<font color='red'>" . $arr['high'][$tempScale] . $tempUnit . " </font>";
$html .= "<font color='blue'>" . $arr['low'][$tempScale] . $tempUnit . "</font>";
$html .= "</td>";
}
foreach($dataArray['simpleforecast']['forecastday']作为$arr){
$html.=''.$arr['date']['weekday'].“
”;
$html.=“
”;
$html.=''.$arr['high'][$tempScale].$tempUnit.“;
$html.=''.$arr['low'][$tempScale].$tempUnit.“;
$html.=”;
}
我只是假设你是这个意思,因为你不太清楚自己想要什么
$html = "<ul>";
foreach ($dataArray['simpleforecast']['forecastday'] as $arr) {
$html .= "<li>" . $arr['date']['weekday'] . "<br />";
$html .= "<img src='http://icons-pe.wxug.com/i/c/a/" . $arr['icon'] . ".gif' border=0 /><br />";
$html .= "<font color='red'>" . $arr['high'][$tempScale] . $tempUnit . " </font>";
$html .= "<font color='blue'>" . $arr['low'][$tempScale] . $tempUnit . "</font>";
$html .= "</li>";
}
$html .= "</ul>";
但是,由于我现在不知道是否是今天,所以我将此问题留给您解决。数据还显示了包括当天在内的6天预测。。。如何将其修改为不显示当前日期。感谢您以列表格式而不是水平排列外部数据,但M_rk通过将标记更改为
只是一个伪代码,旨在说明这个想法。
if(today) continue;