【发布时间】:2017-12-13 18:21:23
【问题描述】:
我正在从目录中检索图像,但所有图像仅显示在一行中,因此在每列 4 之后,该行应递增,其余应显示在下一行..
$<?php
$files = glob("images/hardware/*.*");
//$files1=glob("images/software/*.*");
?>
<div class="container">
<h3>Hardware Solutions</h3>
<table>
<tr>
<?php for ($j = 0; $j < count($files); $j++) {
$image = $files[$j];
//$imagePath=pathinfo($files[$j]);
//$imgdetail=implode(" ",$imagePath);
//echo ''.$imgdetail.'';
?>
<td>
<img src="<?php echo ''.$image.'';?>" width="300px" height="300px" style="text-align:center;padding:10px;"/>
<?php }?>
</td>
</tr>
</table>
【问题讨论】:
-
您在此处向我们展示的代码没有显示试图解决问题的证据。此外,提出的问题是解决布局问题的糟糕方法。
标签: php html loops html-table