(PHP 4, PHP 5, PHP 7, PHP 8)
pg_close — 關(guān)閉一個 PostgreSQL 連接
$connection
= ?): bool
pg_close() 關(guān)閉由所給資源 connection
指定的到 PostgreSQL 數(shù)據(jù)庫的非持久連接。
注意:
使用 pg_close() 并不很必要,因為非持久連接在本腳本執(zhí)行結(jié)束后會自動關(guān)閉。
如果在此連接中打開了 large object 資源,則在關(guān)閉所有 large object 資源之前不要關(guān)閉連接。
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
。
示例 #1 pg_close() 例子
<?php
$dbconn = pg_connect("host=localhost port=5432 dbname=mary")
or die("Could not connect");
echo "Connected successfully";
pg_close($dbconn);
?>
以上例程會輸出:
Connected successfully