array ( 0 => 'index.php', 1 => 'PHP Manual', ), 'head' => array ( 0 => 'UTF-8', 1 => 'zh', ), 'this' => array ( 0 => 'function.pg-connection-status.php', 1 => 'pg_connection_status', ), 'up' => array ( 0 => 'ref.pgsql.php', 1 => 'PostgreSQL 函数', ), 'prev' => array ( 0 => 'function.pg-connection-reset.php', 1 => 'pg_connection_reset', ), 'next' => array ( 0 => 'function.pg-consume-input.php', 1 => 'pg_consume_input', ), 'alternatives' => array ( ), 'source' => array ( 'lang' => 'zh', 'path' => 'reference/pgsql/functions/pg-connection-status.xml', ), ); $setup["toc"] = $TOC; $setup["toc_deprecated"] = $TOC_DEPRECATED; $setup["parents"] = $PARENTS; manual_setup($setup); ?>
(PHP 4 >= 4.2.0, PHP 5, PHP 7, PHP 8)
pg_connection_status — 获取连接状态
pg_connection_status() 返回指定 connection
的状态。
版本 | 说明 |
---|---|
8.1.0 |
现在 connection 参数接受 PgSql\Connection
实例,之前接受 resource。
|
示例 #1 pg_connection_status() 示例
<?php
$dbconn = pg_connect("dbname=publisher") or die("Could not connect");
$stat = pg_connection_status($dbconn);
if ($stat === PGSQL_CONNECTION_OK) {
echo 'Connection status ok';
} else {
echo 'Connection status bad';
}
?>