<table>
<tr>
<th>image</th>
</tr>
<?php
$query = "SELECT * FROM collage";
$result = mysqli_query($con, $query);
while($row = mysqli_fetch_array($result))
{
?>
<tr>
<td><a href="img/collage/<?php echo $row['file'] ?>" target="_blank"><img src="img/collage/<?php echo $row['file'] ?>"></a></td>
</tr>
<?php
}
?>
</table>
你好天才程序员! 我上面的代码显示这样的图像:
最佳答案
设置<tr></tr>
来自 <?php ?>
试试这个
<table>
<tr>
<th>image</th>
</tr>
<tr>
<?php
$query = "SELECT * FROM collage";
$result = mysqli_query($con, $query);
while($row = mysqli_fetch_array($result))
{
?>
<td><a href="img/collage/<?php echo $row['file'] ?>" target="_blank"><img src="img/collage/<?php echo $row['file'] ?>"></a></td>
<?php
}
?>
</tr>
</table>
关于javascript - 从左到右显示图像php,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39611809/