急救!我存在数据库里的图片没法显示 把显示图片做成单独文件,然后以这种方式调用<img src="你显示图片的php文件"> 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 比如这样:<?php/*----viewimg.php---------- 数据库名任意,表名也任意,在这里可以设为binary_table先。 结构为 id,filetype(图片类型),filename(图片的文件名),binary_data(上传的图片的内容) 使用方法,就如同上面的老兄说的。<img src=viewimg.php> $conn=mysql_connect("localhost",$dbuser,$dbpass); mysql_select_db($dbname,$conn); $sqlcmd="select * from binary_table where id=1"; $result=mysql_query($sqlcmd); $image=mysql_fetch_array($result); header("Content-Type:$image['filetype']"); header("Content-Disposition:inline;filename=image['filename']"); print $image["binary_data"]; mysql_free_result($result); mysql_close($conn);?> 还有,要注意的,就是在header前不许有任何输出(包括空格) Web开发职位(google) 站内搜索大小写的问题 显示ip地址的问题!! 新闻系统的外部链接问题 html代码怎么存入数据库? mysql连接上了后,怎么判断数据库是否存在,不存在则新建一个数据库 提问! 怎样以数组的方式实现多个删除?? 紧急问题,请问!在PHP+SQL SERVER中怎样实现分页? php的二级菜单联动问题 有没有判断一数是否在一已知数组中的函数? 心里蛮有成就感的
<?php
/*----viewimg.php----------
数据库名任意,表名也任意,在这里可以设为binary_table先。
结构为 id,filetype(图片类型),filename(图片的文件名),binary_data(上传的图片的内容)
使用方法,就如同上面的老兄说的。<img src=viewimg.php>
$conn=mysql_connect("localhost",$dbuser,$dbpass);
mysql_select_db($dbname,$conn);
$sqlcmd="select * from binary_table where id=1";
$result=mysql_query($sqlcmd);
$image=mysql_fetch_array($result);
header("Content-Type:$image['filetype']");
header("Content-Disposition:inline;filename=image['filename']");
print $image["binary_data"];
mysql_free_result($result);
mysql_close($conn);
?>