我得到了一个包含624张图片的数组,它们的命名是这样的:
1n1e.png
1n2e.png
..
2n1e.png
2n2e.png
等等。最大'n'值为13,最大'e'值为48,这意味着- 13n48e
。
我想创建一个13x48的表格,并相应地放置所有这些图像。
1n1e is located in bottom left corner,
13n1e is at the top left corner,
13n48e at the top right corner,
1n48e at the bottom right corner.
编辑:我有这个旧代码,但它不工作,我想:
echo "<table border='1'>";
$oldIndex=0;
$row=1;
foreach($images as $image)
{
if(substr($image,0,1)!=$oldIndex)
{
if($row>1){echo "</tr>";}
echo "<tr>";
$oldIndex=substr($image,0,1);
$row++;
}
echo "<td>$image</td>";
}
echo "</table>";
…像这样的?
echo "<table>";
for( $n =13; $n >= 1; $n-- )
{
echo "<tr>";
for ( $e = 1; $e <= 48; $e++ )
{
echo "<td>";
echo image $n $e
echo "</td>";
}
echo "</tr>";
}
echo "</table>";