0

如何使用 php 从 bytea 字段的 img 标签中加载图片?我正在使用 postgresql 数据库

我试过的:

<?php
// Connect to the database
$con_qupos = pg_connect('host=192.168.60.254 dbname=dbqupos user=postgres password=12345') or die(pg_last_error());

// Get the bytea data
$res = pg_query('select foto from "schSuperCristian".articulo_foto where codigo_referencia='."'8711600305960'");
$raw = pg_fetch_result($res, 'foto');

// Convert to binary and send to the browser
header('Content-type: image/jpeg');
echo pg_unescape_bytea($raw);
?>
4

0 回答 0