当前位置: 首页>>代码示例>>PHP>>正文


PHP Client::getInstance方法代码示例

本文整理汇总了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();
 }
开发者ID:marcellovetro,项目名称:hook-php,代码行数:7,代码来源:Collection.php

示例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);
     }
 }
开发者ID:jinguanio,项目名称:shadowsocks-swoole-php,代码行数:23,代码来源:ShadowSocks.php

示例3: getExchangeRates

 /**
  * @return the exchange rates
  */
 public static function getExchangeRates()
 {
     return Client::getInstance()->get_xrate();
 }
开发者ID:digitaldevelopers,项目名称:gocoin-woocommerce,代码行数:7,代码来源:GoCoin.php

示例4: Client

 /**
  * Returm Client class instance
  * 
  * @return Client
  */
 public static function Client()
 {
     return Client::getInstance();
 }
开发者ID:digideskio,项目名称:whmcs-stregistry-module,代码行数:9,代码来源:STRegistry.php

示例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;
     }
 }
开发者ID:digitaldevelopers,项目名称:gocoin-woocommerce,代码行数:13,代码来源:GoCoinAdmin.php

示例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");
    }
}
开发者ID:afzalex,项目名称:Notifier,代码行数:31,代码来源:index.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);
#
#
开发者ID:BudgetMailer,项目名称:budgetmailer-php-api,代码行数:31,代码来源:example.php


注:本文中的Client::getInstance方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。