PHPマニュアル/PEARマニュアル | ユーザフォーラムで議論/質問 | マニュアル検索 | ハイライト | ハイライトオフ | ポータル | php spot

Yar_Concurrent_Client::call - Register a concurrent call | JavaScript入門&応用&リファレンスなら「JavaScriptist」

  

Yar_Concurrent_Client::call

(PECL yar >= 1.0.0)

Yar_Concurrent_Client::callRegister a concurrent call

説明

public static int Yar_Concurrent_Client::call ( string $uri , string $method , array $parameters [, callable $callback ] )

Register a RPC call, but won't sent it immediately, it will be send while further call to Yar_Concurrent_Client::loop()

パラメータ

uri

The RPC server URI(http, tcp)

method

Service name(aka the method name)

parameters

Parameters

callback

A function callback, which will be called while the response return.

返り値

An unique id, can be used to identified which call it is.

例1 Yar_Concurrent_Client::call() example

<?php
function callback($retval$callinfo) {
     
var_dump($retval);
}

function 
error_callback($type$error$callinfo) {
    
error_log($error);
}

Yar_Concurrent_Client::call("http://host/api/""some_method", array("parameters"), "callback");
Yar_Concurrent_Client::call("http://host/api/""some_method", array("parameters"));   // if the callback is not specificed, 
                                                                               // callback in loop will be used
Yar_Concurrent_Client::call("http://host/api/""some_method", array("parameters"), "callback"NULL, array(YAR_OPT_PACKAGER => "json"));
                                                                               
//this server accept json packager
Yar_Concurrent_Client::call("http://host/api/""some_method", array("parameters"), "callback"NULL, array(YAR_OPT_TIMEOUT=>1));
                                                                               
//custom timeout 

//The requests are not sent yet
?>

上の例の出力は、 たとえば以下のようになります。

参考


忘却曲線を使ってこの知識を確実に記憶に残す

フォーラムで「Yar_Concurrent_Client::call - Register a concurrent call」について話す
各種マニュアル: PHPマニュアル | PEARマニュアル | Smarty(英語)マニュアル | PHP-GTKマニュアル | Yar_Concurrent_Client::call - Register a concurrent call」をGoogle検索
copyright © 1997-2024 PHP ドキュメント作成グループ(ライセンス). provided by php spot. マニュアル: