13 行
386 B
PHP
13 行
386 B
PHP
<?php
|
|
function uuid () {
|
|
return sprintf(
|
|
"%04x%04x-%04x-%04x-%04x-%04x%04x%04x",
|
|
mt_rand(0, 0xffff), mt_rand(0, 0xffff), // 32bitlow
|
|
mt_rand(0, 0xffff), // 16bitmid
|
|
mt_rand(0, 0x0fff) | 0x4000, // 16bithigh
|
|
mt_rand(0, 0x3fff) | 0x8000, // 16bit|8bithigh|low
|
|
mt_rand(0, 0xffff), mt_rand(0, 0xffff), mt_rand(0, 0xffff) // 48bitnode
|
|
);
|
|
}
|
|
?>
|