PHP Conference Ehime 2026

pg_service

(PHP 8 >= 8.5.0)

pg_serviceGets the service name of the connection

Descrizione

function pg_service(?PgSql\Connection $connection = null): string

Returns the name of the connection service used to establish the connection, as defined in the connection service file.

This function is only available if PHP has been built against libpq 18 or later.

Elenco dei parametri

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().

Avviso

As of PHP 8.1.0, using the default connection is deprecated.

Valori restituiti

A string containing the service name of the connection, or an empty string if no service was used.

Vedere anche:

  • pg_connect() - Stabilisce una connessione PostgreSQL
  • pg_dbname() - Restituisce il nome del database
  • pg_host() - Restituisce il nome dell'host associato alla connessione
  • pg_port() - Restituisce il numero di porta associato alla connessione
add a note

User Contributed Notes

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