WordPress\AiClientDependencies\Psr\Http\Message

ServerRequestInterface::getAttribute │ public │ WP 1.0

Retrieve a single derived request attribute.

Retrieves a single derived request attribute as described in getAttributes(). If the attribute has not been previously set, returns the default value as provided.

This method obviates the need for a hasAttribute() method, as it allows specifying a default value to return if the attribute is not found.

Метод класса: ServerRequestInterface{}

Хуков нет.

Возвращает

mixed.

Использование

$ServerRequestInterface = new ServerRequestInterface();
$ServerRequestInterface->getAttribute( $name, $default );
$name(строка) (обязательный)
The attribute name.
$default(разное)
Default value to return if the attribute does not exist.
По умолчанию: null

Заметки

Смотрите: getAttributes()

Код ServerRequestInterface::getAttribute() WP 7.1.2

public function getAttribute(string $name, $default = null);