2014-04-10 119 views
0

我试图从MySQL数据库中检索图像。我得到这个错误:从数据库中获取图像

Warning: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\empinfo.php:13) in C:\xampp\htdocs\empinfo.php on line 39

<?php 
header("content_type:" . $row["image_type"]); 

?> 
<?php echo $info['image']; ?></td> 
</tr> 

</table> 
<?php } ?> 
+0

请问*为什么*您为什么*将实际图像存储在数据库中,而不是路径?您的代码无法正常工作,因为您将内容类型设置为图像,然后使用HTML – andy

+0

实际上:您的错误与您在输出内容之后使用'header' *的事实有关:https:// stackoverflow.com/questions/8028957/how-to-fix-headers-already-sent-error-in-php但即使修复它也不会工作 – andy

回答

0

“头”功能有别的之前进行打印。

也许在php标签之前有一些空白。 你必须删除它。

0

Warning: Cannot modify header information

这不是一个错误。这是警告。

I'm trying to retrieve an image from a MySQL database

这是Apache/PHP警告。 在调用标题之前,您发送了一些输出(回显,html,空格等)...

相关问题