Skip to content

Instantly share code, notes, and snippets.

@jimmyleeking
Last active January 23, 2021 12:26
Show Gist options
  • Save jimmyleeking/7ae3afee697adbca3ec6f4456d14c833 to your computer and use it in GitHub Desktop.
Save jimmyleeking/7ae3afee697adbca3ec6f4456d14c833 to your computer and use it in GitHub Desktop.
php随机数
function uuid()
{
$chars = md5(uniqid(mt_rand(), true));
$uuid = substr ( $chars, 0, 8 ) . '-'
. substr ( $chars, 8, 4 ) . '-'
. substr ( $chars, 12, 4 ) . '-'
. substr ( $chars, 16, 4 ) . '-'
. substr ( $chars, 20, 12 );
return $uuid ;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment