我目前正在使用以下PHP foreach代码.当我查看源代码时,它是一个巨大的列表项块.
我的问题是,如何编辑它,以便源代码中的每个列表项都在它自己的行上以便于调试?
foreach($xml->Event as $event) {
    echo '<li><a href="', $event->link, '">';
        echo '<strong>', $event->title, '</strong>';
        echo '<span>', $event->beginDate, ' at ', $event->beginTime, '</span>';
        echo $event->location;
    echo '</a></li>';
}
像这样:
foreach($xml->Event as $event) {
    echo '<li><a href="', $event->link, '">';
        echo '<strong>', $event->title, '</strong>';
        echo '<span>', $event->beginDate, ' at ', $event->beginTime, '</span>';
        echo $event->location;
    echo '</a></li>' . "\n";
}
只需添加. "\n"到循环中的最后一行即可.
| 归档时间: | 
 | 
| 查看次数: | 6617 次 | 
| 最近记录: |