当前位置: 首页>>代码示例>>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;未经允许,请勿转载。