mirror of
https://github.com/zhamao-robot/zhamao-framework.git
synced 2026-07-21 15:45:36 +08:00
commitment, nothing
This commit is contained in:
@@ -317,4 +317,16 @@ function getAllFdByConnectType(string $type = 'default'): array {
|
||||
|
||||
function zm_atomic($name) {
|
||||
return \ZM\Store\ZMAtomic::get($name);
|
||||
}
|
||||
|
||||
function uuidgen($uppercase = false) {
|
||||
try {
|
||||
$data = random_bytes(16);
|
||||
} catch (Exception $e) {
|
||||
return "";
|
||||
}
|
||||
$data[6] = chr(ord($data[6]) & 0x0f | 0x40);
|
||||
$data[8] = chr(ord($data[8]) & 0x3f | 0x80);
|
||||
return $uppercase ? strtoupper(vsprintf('%s%s-%s-%s-%s-%s%s%s', str_split(bin2hex($data), 4))) :
|
||||
vsprintf('%s%s-%s-%s-%s-%s%s%s', str_split(bin2hex($data), 4));
|
||||
}
|
||||
Reference in New Issue
Block a user