我正在尝试从数据库在网页上显示图像,但是它只是在网页上显示我图像的文件名
获取图像的代码是
<?php
error_reporting(0);
$query = "SELECT * FROM blog_posts";
$data = mysqli_query($link, $query);
$total = mysqli_num_rows($data);
while ($result = mysqli_fetch_assoc($data)) {
echo $result['title'] . "<br>" . $result['author'] . "<br>" . $result['file_name'] . "<br>" . $result['body'] . "<br>";
}
?>
答案 0 :(得分:0)
只需更改此行
<select class="kt-selectpicker" data-live-search="true" title="Code Numbers" ng-model="item.Suit_Id" data-style="btn-brand" style="width:100%">
@foreach (var item in dbContext.Customers.ToList())
{
<option value="@item.Customer_Id" @(item.DhoobiId==ViewBag.Customer_Id ? "selected='selected'" : "")>@item.Customer_Code_No</option>
}
</select>
但您应该获得文件的完整目录,而不仅仅是名称或
您应该这样写
echo $result['title'] . "<br>" . $result['author'] . "<br> <img src '" . $result['file_name'] . "'><br>" . $result['body'] . "<br>";
然后,您可以将$ filename放在img标签中,如下所示
$file_name ="/dir/dir/".$result['file_name'];