Yar_Concurrent_Client::call

(PECL yar >= 1.0.0)

Yar_Concurrent_Client::call注锟斤拷一锟斤拷锟斤拷锟叫的凤拷锟斤拷锟斤拷锟�

说锟斤拷

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

注锟斤拷一锟斤拷锟斤拷锟叫碉拷(锟届步锟斤拷)远锟教凤拷锟斤拷锟斤拷锟�, 锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷蟛换岜伙拷锟斤拷锟斤拷锟斤拷锟�, 锟斤拷锟角伙拷锟节斤拷锟斤拷锟斤拷锟斤拷锟斤拷 Yar_Concurrent_Client::loop()锟斤拷时锟斤拷锟斤拷锟斤拷锟斤拷姆锟斤拷统锟饺�.

锟斤拷锟斤拷

uri

RPC 锟斤拷锟斤拷锟� URI(http 锟斤拷 tcp).

method

锟斤拷锟矫的凤拷锟斤拷锟斤拷锟斤拷(也锟斤拷锟角凤拷锟今方凤拷锟斤拷).

parameters

锟斤拷锟矫的诧拷锟斤拷.

callback

锟截碉拷锟斤拷锟斤拷, 锟斤拷远锟教凤拷锟斤拷姆锟斤拷氐锟斤拷锟斤拷时锟斤拷Yar锟斤拷锟斤拷, 锟接讹拷锟斤拷锟皆达拷锟斤拷锟斤拷锟斤拷锟斤拷.

锟斤拷锟斤拷值

唯一 ID锟斤拷 锟斤拷锟斤拷锟斤拷锟斤拷锟街碉拷锟斤拷锟斤拷锟角革拷锟斤拷锟矫的凤拷锟斤拷.

锟斤拷锟斤拷

Example #1 Yar_Concurrent_Client::call()示锟斤拷

<?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 

// 锟斤拷锟绞憋拷锟斤拷锟斤拷蠖蓟锟矫伙拷蟹锟斤拷锟�
?>

锟斤拷锟斤拷锟斤拷锟教碉拷锟斤拷锟斤拷锟斤拷锟斤拷冢锟�

锟轿硷拷