0

624 個の画像の配列を取得しました。魔女は次のように名前が付けられています。

1n1e.png
1n2e.png
..
2n1e.png
2n2e.png

等々。最大 'n' 値は 13 で、最大 'e' 値は 4813n48eです。

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>";
4

1 に答える 1

0

.. このようなもの?

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>";
于 2013-03-29T12:14:21.317 に答える