I can't find any syntax or logical error in this code, but i don't why the image is not being displayed on the web page, also it is not showing any error,i'm sharing the code and the output that i'm getting. If you can help me in displaying image, i'll be very thankful to you.디스플레이 이미지는
<html>
<body>
<?php
$servername = "localhost";
$username = "root";
$password = "";
$dbname = "CSE";
// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
$query = "SELECT * FROM upload WHERE id=1";
$result = $conn->query($query);
while($row = $result->fetch_assoc())
{
header("Content-Type: image/png");
echo '<img height="300" width="300" alt="logo" src="data:image;base64,'.$row["name"].'">';
}
$conn->close();
?>
</body>
</html>
먼저 헤더 선언을 제거하십시오. 브라우저에 이미지를 출력하지 않고 HTML을 출력합니다. 이미 콘텐츠를 브라우저에 보낸 후에는 헤더를 보낼 수 없습니다. –
그리고 당신이 보았던 것은 PHP 파일이었습니다. – csmckelvey