pg_connection_status

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

pg_connection_status 获取连接状态

说明

pg_connection_status(PgSql\Connection $connection): int

pg_connection_status() 返回指定 connection 的状态。

参数

connection

PgSql\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';
}
?>

参见

add a note

User Contributed Notes

There are no user contributed notes for this page.
To Top