Yar_Client::__call

(PECL yar >= 1.0.0)

Yar_Client::__call调用远程服务

说明

public Yar_Client::__call(string $method, array $parameters): void

发起一个 RPC 调用, 并且得到返回值. 如果服务端的远程调用抛出异常, 那么本地也会相应的抛出一个 Yar_Server_Exception 异常。

参数

method

远程服务的名字.

parameters

调用参数.

返回值

示例

示例 #1 Yar_Client::__call() 示例

<?php

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

/* 调用远程服务的some_method服务 */
$result = $client->some_method("parameter");

?>

以上示例的输出类似于:


参见

add a note

User Contributed Notes

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