【发布时间】:2014-08-12 11:39:03
【问题描述】:
我整晚都在弄乱这段代码,但一直没能完全正确,甚至不确定要搜索什么。
这就是我正在做的事情。我正在使用 PHP 将 .ini 文件解析为 HTML 表。
这是我在 html 文件中使用的内容:
<?php
$datas = parse_ini_string(file_get_contents( 'https://dl.dropboxusercontent.com/u/12345/test.ini' ), true);
?>
<table border="1" cellspacing="0" cellpadding="5">
<tbody>
<?php
foreach( $datas as $data ) {
?>
<tr>
<td rowspan="2"><?php echo htmlspecialchars( $data["name"] ); ?></td>
<td>Name</td>
<td>Points</td>
</tr>
<tr>
<td><?php echo htmlspecialchars( $data["Name"] ); ?></td>
<td><?php echo htmlspecialchars( $data["Points"] ); ?></td>
</td>
</tr>
<?php
}
?>
</tbody>
</table>
我想在桌子上显示的是下面标记为“第 n 部分”的内容:
[Section 1]
Points=3
[Section 2]
Points=173
[Section 3]
Points=173
我不清楚如何在表格中显示“Section n”,我希望它采用以下格式:
Section number | Points
Section 1 | 3
Section 2 | 173
Section 3 | 173
非常感谢任何帮助或指点!非常感谢!!
【问题讨论】: