pg_connection_status

(PHP 4 >= 4.2.0, PHP 5, PHP 7, PHP 8)

pg_connection_status 获得连接状态

说明

pg_connection_status(resource $connection): int

pg_connection_status() 返回一个连接的状态。可能的状态为 PGSQL_CONNECTION_OKPGSQL_CONNECTION_BAD

示例 #1 pg_connection_status() 例子

<?php
    $dbconn 
pg_connect("dbname=publisher") or die("Could not connect");
    
$stat pg_connection_status($dbconn);
    echo 
'connection_status: '.$stat;
?>

示例 #2 pg_connection_status() 例子

<?php
    $dbconn 
pg_connect("dbname=publisher") or die("Could not connect");
    
$stat pg_connection_status($dbconn);
    echo 
'connection_status: '.$stat;
?>

参见 pg_connection_busy()