php 输出图片,header('Content-type: image/jpg')问题
小问题,麻烦大家!
本想在sql里边存储图片,先用file_get_contents()读入图片,但不知道为什么用header('Content-type: image/jpg')输出的就是乱码。
代码如下:
<?php
$image = file_get_contents("001.jpg"); //假设当前文件夹已有图片001.jpg
$content=addslashes($image);
header('Content-type: image/jpg');
echo $content;
?>
问什么这样不能echo出来图片呢?