接続ステータスを取得する
$connection
pg_connection_status は、 connection で指定した接続のステータスを返します。
connection
PgSql\Connection クラスのインスタンス。
PGSQL_CONNECTION_OK あるいは PGSQL_CONNECTION_BAD 。
PGSQL_CONNECTION_OK
PGSQL_CONNECTION_BAD
例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'; } ?>