当前位置:Gxlcms > PHP教程 > 显示数据库中blob类型的图片,小弟我图片显示不出来

显示数据库中blob类型的图片,小弟我图片显示不出来

时间:2021-07-01 10:21:17 帮助过:19人阅读

显示数据库中blob类型的图片,我图片显示不出来
showimage.php

include_once dirname(dirname (dirname ( __FILE__ ))). '/yeqztsys1.0/utilityfunction/SqlHelp.class.php';
include_once dirname(dirname (dirname ( __FILE__ ))). '/yeqztsys1.0/Comm.class.php';

$SqlHelper = new SqlHelp ( 'read', 'qztoa' );
$sql = "select * from qzt_image";
$query = $SqlHelper->query($sql );
$query_num = $SqlHelper->num_rows ($query );

$rows = array ();
$retarr = array ();
$query =$SqlHelper->query ( $sql );
if($query)
{
$arr_teainfo2 = array ();
while ( $arr_teainfo = $SqlHelper->fetch_assoc($query) ) {
$arr_teainfo2 [] = $arr_teainfo;
$Id=$arr_teainfo["Id"];
echo $arr_teainfo["Id"];
echo "";

}
}



?>


Second.php3

include_once dirname(dirname (dirname ( __FILE__ ))). '/yeqztsys1.0/utilityfunction/SqlHelp.class.php';
include_once dirname(dirname (dirname ( __FILE__ ))). '/yeqztsys1.0/Comm.class.php';

$SqlHelper = new SqlHelp ( 'read', 'qztoa' );
$sql = "select * from qzt_image where Id=10";
$query = $SqlHelper->query($sql );
$query_num = $SqlHelper->num_rows ($query );

$rows = array ();
$retarr = array ();
$query =$SqlHelper->query ( $sql );
if($query)
{
$arr_teainfo2 = array ();
while ( $arr_teainfo = $SqlHelper->fetch_assoc($query) ) {
$arr_teainfo2 [] = $arr_teainfo;
$Id=$arr_teainfo["Id"];
$imagetype=$arr_teainfo["imagetype"];
//echo $arr_teainfo["images"];
//Header( "Content-type: $imagetype");
header('Content-type: $imagetype');
echo $arr_teainfo["images"];

}
}

?>


请问我哪里有问题?PHP新人,不知道哪里错了 PHP

分享到:


------解决方案--------------------
引用:
Quote: 引用:

图片显示不出来,是程序报错?还是路径不对。
先打印下,看有数据没,如果有,再看下,显示的路径是否正确。

先运行php3把image打印出来了,正常的,没有报错

include_once dirname(dirname (dirname ( __FILE__ ))). '/yeqztsys1.0/utilityfunction/SqlHelp.class.php';
include_once dirname(dirname (dirname ( __FILE__ ))). '/yeqztsys1.0/Comm.class.php';

$SqlHelper = new SqlHelp ( 'read', 'qztoa' );
$sql = "select * from qzt_image where Id=10";
$query = $SqlHelper->query($sql );

人气教程排行