PHP 8.5.10 Released!

Yar_Client::__construct

(PECL yar >= 1.0.0)

Yar_Client::__constructCreate a client

Beschreibung

final public function Yar_Client::__construct(string $uri, ?array $options = null)

Creates a Yar_Client for the RPC service located at uri.

Parameter-Liste

uri

Address of the RPC service. The protocol is derived from the scheme: http:// and https:// select the HTTP transport, tcp:// selects the TCP transport, and unix:// selects the Unix socket transport.

options

An Array of client options, keyed by the YAR_OPT_* constants, equivalent to calling Yar_Client::setOpt() for each entry. Invalid options are silently skipped.

Rückgabewerte

A new Yar_Client instance.

Fehler/Exceptions

If the URI does not start with a supported scheme, a Yar_Client_Protocol_Exception is thrown.

Beispiele

Beispiel #1 Yar_Client::__construct() example

<?php
$client = new Yar_Client("http://host/api/");

/* with options */
$client = new Yar_Client("http://host/api/", [
    YAR_OPT_TIMEOUT => 1000,
    YAR_OPT_PACKAGER => "json",
]);
?>

Siehe auch

add a note

User Contributed Notes

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