[英]How to display an image that is stored in the database?
<?php
$query = "SELECT * FROM table WHERE id = 2";
$result = mysqli_query($con, $query);
$result_set = mysqli_fetch_array($result);
echo $result_set['img'];
?>
为什么要显示奇怪的字符,而不是图像?
您需要在开头添加Content-Type标头,例如
<?
header('Content-Type: image/png');
?>
对于PNG图像
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.