pg_ping
(PHP 4 >= 4.3.0, PHP 5, PHP 7, PHP 8)
pg_ping — Ping 數據庫連線
說明
pg_ping(resource
$connection
): bool
pg_ping() ping
數據庫連線,如果中斷則嘗試重新連線。如果連線在活動狀態返回
true
,否則返回 false
。
示例 #1 pg_ping()
<?php
$conn = pg_pconnect ("dbname=publisher");
if (!$conn) {
echo "An error occured.\n";
exit;
}
if (!pg_ping($conn))
die("Connection is broken\n");
?>