本文整理汇总了PHP中Uuid::v1方法的典型用法代码示例。如果您正苦于以下问题:PHP Uuid::v1方法的具体用法?PHP Uuid::v1怎么用?PHP Uuid::v1使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Uuid
的用法示例。
在下文中一共展示了Uuid::v1方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: generate
/**
* @brief Generates a Universally Unique IDentifier, version 1, 3, 4 or 5.
*
* This function generates a truly random UUID. The built in CakePHP String::uuid() function
* is not cryptographically secure. You should uses this function instead.
*
* @see http://tools.ietf.org/html/rfc4122#section-4.4
* @see http://en.wikipedia.org/wiki/UUID
* @return string A UUID, made up of 32 hex digits and 4 hyphens.
*/
function generate($version = null, $ns = null, $name = null)
{
if ($version == null) {
$version = $this->version;
}
switch ($version) {
case Uuid::UUID_V1:
return Uuid::v1();
case Uuid::UUID_V3:
return Uuid::v3($ns, $name);
case Uuid::UUID_V4:
return Uuid::v4();
case Uuid::UUID_V5:
return Uuid::v5($ns, $name);
}
}
示例2: generate
/**
* Generate an activation Key
*
*/
public static function generate()
{
return sha1(Uuid::v1() . time());
}