(PHP 4 >= 4.3.0, PHP 5, PHP 7, PHP 8)
pg_ping — Effettua il ping alla connessione del database
pg_ping() esegue il ping ad una connessione al database e tenta di ricollegarla se è interrotta.
connection
An PgSql\Connection instance.
When connection
is null
, the default connection is used.
The default connection is the last connection made by pg_connect()
or pg_pconnect().
As of PHP 8.1.0, using the default connection is deprecated.
Versione | Descrizione |
---|---|
8.1.0 |
The connection parameter expects an PgSql\Connection
instance now; previously, a resource was expected.
|
8.0.0 |
connection is now nullable.
|
Example #1 Esempio di pg_ping()
<?php
$conn = pg_pconnect("dbname=publisher");
if (!$conn) {
echo "Si è verificato un errore.\n";
exit;
}
if (!pg_ping($conn))
die("La connessione è interrotta\n");
?>