函数名称:Yar_Client::__construct()
适用版本:PHP 5 >= 5.5.0, PHP 7, PECL yar >= 1.0.0
函数说明:Yar_Client类的构造函数,用于创建一个Yar客户端对象。
用法:
__construct ( string $url [, array $options ] ) : void
参数:
返回值:无返回值。
示例:
// 创建一个Yar客户端对象,连接到HTTP服务器
$client = new Yar_Client("http://localhost/api");
// 创建一个Yar客户端对象,连接到TCP服务器,并设置超时时间和持久连接
$options = array(
'timeout' => 10, // 超时时间为10秒
'persistence' => true // 开启持久连接
);
$client = new Yar_Client("tcp://localhost:8080", $options);
注意事项: