= 4.3.0, PHP 5, PHP 7, PHP 8)pg_ping — Ping 數(shù)據(jù)庫連接說明pg_ping(resource $connection): boolpg_ping() ping 數(shù)據(jù)庫連接,如果中斷則嘗試重新連接。如果連接在活動狀態(tài)返回 true">
(PHP 4 >= 4.3.0, PHP 5, PHP 7, PHP 8)
pg_ping — Ping 數(shù)據(jù)庫連接
$connection
): bool
pg_ping() ping
數(shù)據(jù)庫連接,如果中斷則嘗試重新連接。如果連接在活動狀態(tài)返回
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");
?>