Be careful: pg_lo_export() create empty file without "begin"/"end".
See docs: "...it is necessary to enclose it within a transaction block..."
(PHP 4 >= 4.2.0, PHP 5, PHP 7, PHP 8)
pg_lo_read — 读取大对象
pg_lo_read() 从大对象中读取最多 length
字节的数据并以 string 返回。
要使用大对象接口,必须将其封装在一个事务块中。
注意:
本函数以前的名字为 pg_loread()。
包含来自大对象的 length
字节的 string,或错误时为 false
。
示例 #1 pg_lo_read() 示例
<?php
$doc_oid = 189762345;
$database = pg_connect("dbname=jacarta");
pg_query($database, "begin");
$handle = pg_lo_open($database, $doc_oid, "r");
$data = pg_lo_read($handle, 50000);
pg_query($database, "commit");
echo $data;
?>
Be careful: pg_lo_export() create empty file without "begin"/"end".
See docs: "...it is necessary to enclose it within a transaction block..."