如何使用php在表格中显示九张图像,每行三张图像 [英] How to show nine images in a table , three images in each row using php

查看:36
本文介绍了如何使用php在表格中显示九张图像,每行三张图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在一个表格中显示九张图片,使用 PHP 在每行显示三张图片.

I want to show nine images in a table , three images in each row using PHP.

推荐答案

<?php
      $images=ARRAY( a.gif","b.jpeg","c.jif","d.bmp");    
?>

<table border="0" cellspacing="1" cellpadding="0">
    <tr>
      <?php
          for($i=0; $i< count($images); $i++) {
             echo "<td>
                   <table width=100% border=0>
                      <tr><td>
  <img src=Download/$images[$i] width=130 height=130 border=0></td></tr>
                   </table>
                   </td>";
  if ( (($i+1) % 3) == 0 ) echo $newrow="</tr><tr>"; // change 6 to 8 and see
}
    ?>                
</tr>
</table>

这篇关于如何使用php在表格中显示九张图像,每行三张图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆