PHP Conference Ehime 2026

pg_service

(PHP 8 >= 8.5.0)

pg_serviceGets the service name of the connection

Опис

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.

Параметри

connection

Примірник PgSql\Connection. Якщо параметр connectionnull, то виконується стандартне з'єднання, тобто останнє, виконане функцією pg_connect() або pg_pconnect().

Увага

Починаючи з PHP 8.1.0, використання стандартного з'єднання є застарілим.

Значення, що повертаються

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

Прогляньте також

  • pg_connect() - Open a PostgreSQL connection
  • pg_dbname() - Get the database name
  • pg_host() - Returns the host name associated with the connection
  • pg_port() - Return the port number associated with the connection
add a note

User Contributed Notes

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