當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Uuid::uuid3方法代碼示例

本文整理匯總了PHP中Rhumsaa\Uuid\Uuid::uuid3方法的典型用法代碼示例。如果您正苦於以下問題:PHP Uuid::uuid3方法的具體用法?PHP Uuid::uuid3怎麽用?PHP Uuid::uuid3使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Rhumsaa\Uuid\Uuid的用法示例。


在下文中一共展示了Uuid::uuid3方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: generate

 public static function generate($ver = 4, $node = null, $clockSeq = null, $ns = null, $name = null)
 {
     $uuid = null;
     /* Create a new UUID based on provided data. */
     switch ((int) $ver) {
         case 1:
             $uuid = Uuid::uuid1($node, $clockSeq);
             break;
         case 2:
             // Version 2 is not supported
             throw new \RuntimeException('UUID version 2 is unsupported.');
         case 3:
             $uuid = Uuid::uuid3($ns, $name);
             break;
         case 4:
             $uuid = Uuid::uuid4();
             break;
         case 5:
             $uuid = Uuid::uuid5($ns, $name);
             break;
         default:
             throw new \RuntimeException('Selected UUID version is invalid or unsupported.');
     }
     if (function_exists('gmp_strval')) {
         return gmp_strval(gmp_init($uuid->getHex(), 16), 62);
     }
     return Base62::encode((string) $uuid->getInteger());
 }
開發者ID:gponster,項目名稱:laravel-url62-uuid,代碼行數:28,代碼來源:Url62UuidGenerator.php

示例2: createUuid

 /**
  * Creates the requested UUID
  *
  * @param int $version
  * @param string $namespace
  * @param string $name
  * @return Uuid
  */
 protected function createUuid($version, $namespace = null, $name = null)
 {
     switch ((int) $version) {
         case 1:
             $uuid = Uuid::uuid1();
             break;
         case 4:
             $uuid = Uuid::uuid4();
             break;
         case 3:
         case 5:
             $ns = $this->validateNamespace($namespace);
             if (empty($name)) {
                 throw new Exception('The name argument is required for version 3 or 5 UUIDs');
             }
             if ($version == 3) {
                 $uuid = Uuid::uuid3($ns, $name);
             } else {
                 $uuid = Uuid::uuid5($ns, $name);
             }
             break;
         default:
             throw new Exception('Invalid UUID version. Supported are version "1", "3", "4", and "5".');
     }
     return $uuid;
 }
開發者ID:tunandras,項目名稱:webtrees,代碼行數:34,代碼來源:GenerateCommand.php

示例3: v3

 /**
  * 基於名字的MD5散列值
  * [!!] 同一命名空間的同一名字會生成相同的uuid
  *
  * @param  VendorUUID|string $namespace
  * @param  string            $name
  * @return string
  */
 public static function v3($namespace = VendorUUID::NAMESPACE_DNS, $name = 'php.net')
 {
     try {
         $uuid3 = VendorUUID::uuid3($namespace, $name);
         return $uuid3->toString();
     } catch (UnsatisfiedDependencyException $e) {
         return false;
     }
 }
開發者ID:tourze,項目名稱:security,代碼行數:17,代碼來源:UUID.php

示例4: uuid3

 public static function uuid3($ns, $name)
 {
     return BaseUuid::uuid3($ns, $name);
 }
開發者ID:kpacha,項目名稱:sifo-uuid-plugin,代碼行數:4,代碼來源:Uuid.php

示例5: createIdVersion3

 /**
  * generate name base and hashed md5 uuid
  *
  * @param string $namespace base name
  * @return string
  */
 protected function createIdVersion3($namespace)
 {
     return Uuid::uuid3(Uuid::NAMESPACE_DNS, $namespace)->toString();
 }
開發者ID:xpressengine,項目名稱:xpressengine,代碼行數:10,代碼來源:Keygen.php

示例6: uuid

/**
 * Generates a unique UUID string.
 *
 * @return string
 */
function uuid()
{
    return Uuid::uuid3(Uuid::NAMESPACE_DNS, str_random())->toString();
}
開發者ID:stevebauman,項目名稱:quickly-share-it,代碼行數:9,代碼來源:helpers.php

示例7: uuid3

 public static function uuid3($ns, $name)
 {
     return self::bin(BaseUuid::uuid3($ns, $name));
 }
開發者ID:wartron,項目名稱:yii2-uuid,代碼行數:4,代碼來源:Uuid.php

示例8:

 /**
  * Generate a version 3 (name-based and hashed with MD5) UUID object.
  *
  * @param string $ns
  * @param string $name
  *
  * @return string
  */
 function uuid3($ns, $name)
 {
     $uuid = Uuid::uuid3($ns, $name);
     return $uuid->toString();
 }
開發者ID:tshafer,項目名稱:laravel-support,代碼行數:13,代碼來源:Uuid.php


注:本文中的Rhumsaa\Uuid\Uuid::uuid3方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。