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


PHP Daemon::uniqid方法代码示例

本文整理汇总了PHP中PHPDaemon\Core\Daemon::uniqid方法的典型用法代码示例。如果您正苦于以下问题:PHP Daemon::uniqid方法的具体用法?PHP Daemon::uniqid怎么用?PHP Daemon::uniqid使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PHPDaemon\Core\Daemon的用法示例。


在下文中一共展示了Daemon::uniqid方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: perform

 public function perform()
 {
     $hash = Request::getString($_REQUEST['x']);
     if (!strlen($hash) || base64_decode($hash, true) === false) {
         $this->req->setResult(['success' => false, 'error' => 'Wrong format of extTokenHash']);
         return;
     }
     $this->appInstance->externalAuthTokens->findByExtTokenHash($hash, function ($result) use($hash) {
         if ($result) {
             $this->req->setResult(['success' => false, 'error' => 'This token was already used.']);
             return;
         }
         $ip = $this->req->getIp();
         $intToken = Crypt::hash(Daemon::uniqid() . "" . $ip . "" . Crypt::randomString());
         $this->appInstance->externalAuthTokens->save(['extTokenHash' => $hash, 'intToken' => $intToken, 'ip' => $ip, 'useragent' => Request::getString($_SERVER['HTTP_USER_AGENT']), 'ctime' => microtime(true), 'status' => 'new'], function ($lastError) use($intToken) {
             if (!isset($lastError['n']) || $lastError['n'] === 0) {
                 $this->req->setResult(['success' => false, 'errors' => ['code' => 'Sorry, internal error.']]);
                 return;
             }
             $type = Request::getString($_REQUEST['type']);
             if ($type === 'email') {
                 // send email....
             } elseif ($type === 'redirect') {
                 $this->req->redirectTo(HTTPClient::buildUrl(['/' . $this->req->locale . '/account/extauth', 'i' => $intToken]), false);
             }
             $this->req->setResult(['success' => true, 'intToken' => $intToken]);
         });
     });
 }
开发者ID:kakserpom,项目名称:WakePHP,代码行数:29,代码来源:ExtAuth.php

示例2: setPassword

 public function setPassword($value)
 {
     if (($r = static::checkPasswordFormat($value)) !== true) {
         throw new \Exception($r);
     }
     $this->setProperty('salt', $salt = $this->appInstance->config->cryptsalt->value . Crypt::hash(Daemon::uniqid() . "" . $this['email']));
     $this->setProperty('password', Crypt::hash($value, $salt . $this->appInstance->config->cryptsaltextra->value));
     return $this;
 }
开发者ID:kakserpom,项目名称:WakePHP,代码行数:9,代码来源:Account.php

示例3: getAuthorizationHeader

 protected function getAuthorizationHeader($url, $oauth_params = [])
 {
     $params = ['oauth_consumer_key' => $this->cmp->config->twitter_app_key->value, 'oauth_nonce' => Daemon::uniqid(), 'oauth_signature_method' => 'HMAC-SHA1', 'oauth_timestamp' => time(), 'oauth_version' => '1.0'];
     if (!empty($oauth_params)) {
         $params = array_merge($params, $oauth_params);
     }
     $params['oauth_signature'] = OAuth::getSignature('POST', $url, $params, $this->cmp->config->twitter_app_secret->value);
     $header_params = [];
     foreach ($params as $param => $value) {
         $header_params[] = rawurlencode($param) . '="' . rawurlencode($value) . '"';
     }
     $header = 'OAuth ' . implode(', ', $header_params);
     return $header;
 }
开发者ID:kakserpom,项目名称:WakePHP,代码行数:14,代码来源:Twitter.php

示例4: __construct

 /**
  * Save
  * @param string $str JSON string
  */
 public function __construct($str)
 {
     $this->id = Daemon::uniqid();
     static::$tr['"' . $this->id . '"'] = $str;
 }
开发者ID:shamahan,项目名称:phpdaemon,代码行数:9,代码来源:PlainJSON.php

示例5: getAccountBase

 /**
  * @param $req
  * @return array
  */
 public function getAccountBase($req)
 {
     return ['email' => '', 'location' => '', 'ukey' => Crypt::randomString(16), 'confirmationcode' => substr(md5($req->attrs->server['REMOTE_ADDR'] . "" . Daemon::uniqid() . "" . $this->appInstance->config->cryptsalt->value . "" . microtime(true) . "" . mt_rand(0, mt_getrandmax())), 0, 6), 'regdate' => time(), 'etime' => time(), 'ttlSession' => 1200, 'ip' => $req->attrs->server['REMOTE_ADDR'], 'subscription' => 'daily', 'aclgroups' => array('Users'), 'acl' => array()];
 }
开发者ID:kakserpom,项目名称:WakePHP,代码行数:8,代码来源:Accounts.php

示例6: command

 /**
  * Sends arbitrary command
  * @param string   $packet    A packet for sending by the connected client to Asterisk
  * @param callable $cb        Callback called when response received
  * @param array    $assertion If more events may follow as response this is a main part or full an action complete event indicating that all data has been sent
  */
 protected function command($packet, $cb, $assertion = null)
 {
     if ($this->finished) {
         throw new ConnectionFinished();
     }
     if ($this->state !== self::CONN_STATE_HANDSHAKED_OK) {
         return;
     }
     $actionId = Daemon::uniqid();
     if (!is_callable($cb, true)) {
         $cb = false;
     }
     $this->callbacks[$actionId] = CallbackWrapper::wrap($cb);
     if ($assertion !== null) {
         $this->assertions[$actionId] = $assertion;
     }
     $this->write($packet);
     $this->write('ActionID: ' . $actionId . "\r\n\r\n");
 }
开发者ID:cobolbaby,项目名称:phpdaemon,代码行数:25,代码来源:Connection.php


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