its not very clear if pg_lo_import needs to have pg_lo_open called first. Because pg_lo_import handles the process of writign to the file, it seems logical that pg_lo_open does not need to be called. However due to the ugly nature of how postgres handles oid objects, it would be nice to have this documented.
(PHP 4 >= 4.2.0, PHP 5)
pg_lo_import — 将文件导入为大型对象
pg_lo_import() creates a new large object in the database using a file on the filesystem as its data source.
Note: 当启用 安全模式时， PHP 会检查被操作的文件或目录是否与被执行的脚本有相同的 UID（所有者）。
object_idis given the function will try to create a large object with this id, else a free object id is assigned by the server. The parameter was added in PHP 5.3 and relies on functionality that first appeared in PostgreSQL 8.1.
在 PHP 4.2.0 版本之前，本函数语法不一样，见如下定义：
int pg_lo_import ( string
Example #1 pg_lo_import() 例子
$database = pg_connect("dbname=jacarta");
$oid = pg_lo_import($database, '/tmp/lob.dat');
Due to a bug, OLD API does not available with PHP 4.2.0 and 4.2.1.
PHP 4.2.2 will support OLD API again and will be kept long enough.
New API will be available PHP 4.2.0 to later versions.
Due to a bug, PHP 4.2.0 and 4.2.1 does not support pg_lo_import() old API. It's fixed in PHP 4.2.2.
BTW, new API will be always available from PHP 4.2.0 to later versions. Older API will be kept long enough, also.