PHP Conference Ehime 2026

pg_service

(PHP 8 >= 8.5.0)

pg_serviceGets the service name of the connection

Beschreibung

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.

Parameter-Liste

connection

Eine PgSql\Connection-Instanz. Falls connection null ist, wird die Standardverbindung benutzt. Das ist die zuletzt mit pg_connect() oder pg_pconnect() aufgebaute Verbindung.

Warnung

Seit PHP 8.1.0 ist die Verwendung der Standardverbindung veraltet.

Rückgabewerte

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

Siehe auch

  • pg_connect() - Öffnet eine PostgreSQL-Verbindung
  • pg_dbname() - Liefert den Namen der Datenbank
  • pg_host() - Liefert den Namen des Host, zu dem verbunden wurde
  • pg_port() - Liefert die Portnummer, über die die Verbindung aufgebaut wurde
add a note

User Contributed Notes

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