本文整理汇总了PHP中Client::getInstance方法的典型用法代码示例。如果您正苦于以下问题:PHP Client::getInstance方法的具体用法?PHP Client::getInstance怎么用?PHP Client::getInstance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Client
的用法示例。
在下文中一共展示了Client::getInstance方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct(array $options)
{
$this->name = $options['name'];
$this->client = isset($options['client']) ? $options['client'] : Client::getInstance();
$this->segments = 'collection/' . $this->name;
$this->reset();
}
示例2: onReceive
public function onReceive($serv, $fd, $from_id, $rdata)
{
$client = Client::getInstance($fd);
$data = $client->cryptor->decrypt($rdata);
Trace::debug("\n\n\n\n" . str_repeat('#', 20) . "\nquerytimes:" . ++$this->querytimes . "\n" . str_repeat('#', 20) . "\n=======================\nonReceive {$from_id} : {$fd} lenght:" . strlen($data) . " content:\n=======================\n" . substr($data, 0, 50) . "...\n=======================");
if (false === $client->hasInit()) {
$header = Sock5::parseHeader($data);
if (!$header) {
return $serv->close($fd);
}
$client->init($header['addr']);
if (strlen($data) > $header['length']) {
$data = substr($data, $header['length']);
$client->send($data);
}
swoole_async_dns_lookup($header['addr'], function ($host, $ip) use($header, $client, $fd) {
Trace::debug("dnslookup >{$fd}, {$host}, {$ip} ");
$client->connect(ip2long($ip), $header['port']);
});
} else {
$client->send($data);
}
}
示例3: getExchangeRates
/**
* @return the exchange rates
*/
public static function getExchangeRates()
{
return Client::getInstance()->get_xrate();
}
示例4: Client
/**
* Returm Client class instance
*
* @return Client
*/
public static function Client()
{
return Client::getInstance();
}
示例5: deleteMerchantUser
/**
* @return the result of deleting a user from a merchant account
*/
public static function deleteMerchantUser($token, $merchant_id, $user_id)
{
$client = Client::getInstance($token);
$result = $client->api->merchant_users->deleteMerchantUser($merchant_id, $user_id);
if ($result === FALSE) {
throw new Exception($client->getError());
} else {
return $result;
}
}
示例6: session_start
<?php
require_once "res/utils.php";
session_start();
$res = Client::installResult();
if (!isset($_SESSION["client"])) {
$_SESSION["client"] = Client::getInstance();
session_write_close();
}
if (isset($_POST["logorsign"]) && isset($_POST["usernametxt"]) && isset($_POST["userpasstxt"])) {
$client = $_SESSION["client"];
if ($_POST["logorsign"] == 'log') {
$res = $client->authenticate($_POST["usernametxt"], $_POST["userpasstxt"], $_POST["keeplogged"]);
if ($res["code"] == Client::CODE_SUCCESS) {
header("Location: panel.php");
}
} elseif (isset($_POST["usercnfmtxt"]) && ($_POST["logorsign"] = 'sign')) {
$res = $client->signup($_POST["usernametxt"], $_POST["userpasstxt"], $_POST["usercnfmtxt"]);
}
} elseif (isset($_REQUEST["signout"]) && $_REQUEST["signout"] == "true" && session_status() != PHP_SESSION_NONE) {
$_SESSION = array();
$_COOKIE = array();
Client::removeLoggedinSettings();
session_destroy();
session_write_close();
header("Location: index.php");
} elseif (isset($_COOKIE['logged_in_flag'])) {
if ($_SESSION["client"]->verifyKeepLogged($_COOKIE['logged_in_flag'])) {
header("Location: panel.php");
}
}
示例7: CONFIGURATION
$loader = new \AutoloaderPsr4();
$loader->register();
$loader->addNamespace('BudgetMailer\\Api', PHP_BM_ROOT . 'src/BudgetMailer/Api');
#
# 2. GET CONFIGURATION (also optional, you may use Client::getInstance(array $config))
#
$configFile = __DIR__ . '/config.php';
$configData = (include $configFile);
unset($configFile);
if (!is_array($configData) || !count($configData)) {
die('Config not found.');
}
#
# 3. a) INITIATE CLIENT as singleton
#
$client = Client::getInstance(array('key' => '', 'list' => '', 'secret' => ''));
// later you can get client again without config param
#
# 3. b) INITIATE CLIENT
#
$config = new Config($configData);
unset($configData);
$cache = new Cache($config);
$client = new Client($cache, $config);
#
# 4. GET ALL LISTS
#
$lists = $client->getLists();
//var_dump($lists);
#
#