0

嗨,我之前问过一个关于从 MySQL 数据库 Blob 中检索图像的类似问题。

我正在使用代码:

header("Content-type: image/jpeg"); // change it to the right extension 
print $image;   //where image is the blob file

这段代码嵌套在网页中,所以我还应该修改标题吗?当我包含 header() 时,它会删除所有网页代码,我认为这是因为我正在更改浏览器呈现为 image/jpeg 的文件类型?如何在网页内显示图像?谢谢!

4

1 回答 1

1

您不能在网页内显示图像(您可以,但那是另一回事,可能不是您想要的)。您需要将从数据库中检索图像的代码放入一个单独的文件中,并使用

<img src="filename.php">
于 2009-11-20T02:26:20.163 回答