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

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.

返回值

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

参见

添加备注

用户贡献的备注

此页面尚无用户贡献的备注。
To Top