pg_ping
(PHP 4 >= 4.3.0, PHP 5)
pg_ping — Ping 数据库连接
<h3>说明</h3>
bool <strong>pg_ping</strong>
( resource <code>$connection</code>
)
<p>
<strong>pg_ping()</strong> ping
数据库连接,如果中断则尝试重新连接。如果连接在活动状态返回
<strong><code>TRUE</code></strong>,否则返回 <strong><code>FALSE</code></strong>。
</p>
<p>
<p><strong>Example #1 <strong>pg_ping()</strong></strong></p>
<?php
$conn = pg_pconnect ("dbname=publisher");
if (!$conn) {
echo "An error occured.n";
exit;
}
if (!pg_ping($conn))
die("Connection is brokenn");
?>
参见 pg_connection_status() 和
pg_connection_reset()。
</p>