0
所以我有一個查詢正在運行,並且我在while循環中得到了結果。在while循環中,我想通過使用變量將$ image設置爲需要在html頁面上顯示的圖像的變量。我無法獲取在html上顯示的圖像。如何在PHP中將圖像設置爲變量並使用該變量以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;">
非常感謝你的工作 –
不客氣:)我很高興它幫助你 –