本文整理匯總了PHP中Uuid::v5方法的典型用法代碼示例。如果您正苦於以下問題:PHP Uuid::v5方法的具體用法?PHP Uuid::v5怎麽用?PHP Uuid::v5使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Uuid
的用法示例。
在下文中一共展示了Uuid::v5方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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);
}
}