急救!我存在数据库里的图片没法显示 把显示图片做成单独文件,然后以这种方式调用<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前不许有任何输出(包括空格) 关于循环数组合并的问题 关于php的反向引用 求一个实现模糊搜索的sql语句,我想做个站内搜索 大家看看我的php访问mysql的乱码问题!!要命了!!! 我消除所有的前后全半角空格以后有些情况会出乱码·请帮忙、谢谢 为什么取不到值??晕了 100分求救!在线等候,急死了! 如何在apache不停止的情况下,清空日至文件? 关于图片在手机浏览器显示大小的问题 如何锁定友谊链接的用户在自己网站的行踪 有没有判断一数是否在一已知数组中的函数? 心里蛮有成就感的
<?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);
?>