【发布时间】:2017-07-14 19:40:24
【问题描述】:
所以我有一个查询正在运行,我在一个 while 循环中得到结果。在 while 循环中,我想通过使用变量将 $image 设置为需要在 html 页面上显示的图像的变量。我无法在 html 上显示图像。
顺便说一下,图像位于文件夹中。
PHP 代码:
if ($result->num_rows > 0) {
while($row = $result->fetch_assoc()) {
$image = "<img src='images/image1.png'>";
}
}
HTML 代码:
<?php include 'File.php';?>
<img src="<?php echo $image; ?>" alt="Mountain View" style="width:304px;height:228px;">
【问题讨论】: