2014-04-10 116 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,空格等)...

相關問題