在我的数据库中,图像(jpeg,bmp格式)以bytea数据类型存储,以数据库中的二进制代码显示.现在我想从数据库中检索图像.但我无法在网页上看到图像.当我使用下面给出的代码检索时,它显示二进制代码值.(即数字,字符,符号的组合).我的代码是
$dbconn = pg_connect("host=localhost user=xxxx password=xxxx dbname=xxxx")
or die('Could not connect: ' .pg_last_error());
$rs = pg_query($dbconn, "select scan_image from image where cno='4' and imageno='1'");
$image = pg_escape_bytea(pg_fetch_result($rs, 0));
echo $image;
Run Code Online (Sandbox Code Playgroud)
我对这段代码是否正确?请帮我找到解决方案.