(PHP 4, PHP 5)
pg_close — 关闭一个 PostgreSQL 连接
$connection
)
pg_close() 关闭由所给资源 connection
指定的到 PostgreSQL 数据库的非持久连接。成功时返回 TRUE
, 或者在失败时返回 FALSE
.
Note:
使用 pg_close() 并不很必要,因为非持久连接在本脚本执行结束后会自动关闭。
Example #1 pg_close() 例子
<?php
$dbconn = pg_connect("host=localhost port=5432 dbname=mary")
or die("Could not connect");
print("Connected successfully");
pg_close($dbconn);
?>
如果在此连接中打开了 large object 资源,则在关闭所有 large object 资源之前不要关闭连接。
connection
PostgreSQL database connection resource. When
connection
is not present, the default connection
is used. The default connection is the last connection made by
pg_connect() or pg_pconnect().
成功时返回 TRUE
, 或者在失败时返回 FALSE
.
Example #2 pg_close() example
<?php
$dbconn = pg_connect("host=localhost port=5432 dbname=mary")
or die("Could not connect");
echo "Connected successfully";
pg_close($dbconn);
?>
以上例程会输出:
Connected successfully