PHP - Manual: Yar_Client::setOpt
2024-12-22
(PECL yar >= 1.0.0)
Yar_Client::setOpt — 设置调用的配置
name
可以是: YAR_OPT_PACKAGER, YAR_OPT_PERSISTENT (需要服务端支持keepalive), YAR_OPT_TIMEOUT, YAR_OPT_CONNECT_TIMEOUT
value
示例 #1 Yar_Client::setOpt()示例
<?php
$cient = new Yar_Client("http://host/api/");
//Set timeout to 1s
$client->SetOpt(YAR_OPT_CONNECT_TIMEOUT, 1000);
//Set packager to JSON
$client->SetOpt(YAR_OPT_PACKAGER, "json");
/* call remote service */
$result = $client->some_method("parameter");
?>
以上例程的输出类似于: