©
이 문서에서는 PHP 중국어 웹사이트 매뉴얼 풀어 주다
(PECL yar >= 1.0.0)
Yar_Client::setOpt — 设置调用的配置
$name
, mixed $value
)设置调用远程服务的一些配置, 比如超时值, 打包类型等.
name
可以是: YAR_OPT_PACKAGER, YAR_OPT_PERSISTENT (需要服务端支持keepalive), YAR_OPT_TIMEOUT, YAR_OPT_CONNECT_TIMEOUT
value
Example #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" );
$result = $client -> some_method ( "parameter" );
?>
以上例程的输出类似于: