Last Call for the State of PHP Survey

Yar_Client::getOpt

(PECL yar >= 1.1.0)

Yar_Client::getOptRead a client option

说明

public function Yar_Client::getOpt(int $name): mixed

Returns the value previously set with Yar_Client::setOpt(), or with the options parameter of Yar_Client::__construct().

参数

name

One of the YAR_OPT_* constants, see Yar_Client::setOpt().

返回值

The option value, or false if the option has not been set on this client or the option name is unknown.

示例

示例 #1 Yar_Client::getOpt() example

<?php
$client = new Yar_Client("http://host/api/");
$client->setOpt(YAR_OPT_TIMEOUT, 1000);

var_dump($client->getOpt(YAR_OPT_TIMEOUT));
var_dump($client->getOpt(YAR_OPT_PACKAGER));
?>

以上示例的输出类似于:

int(1000)
bool(false)

参见

添加备注

用户贡献的备注

此页面尚无用户贡献的备注。
To Top