PHP生成UUID的一个方法

function

uuid(){

$chars = md5(uniqid(mt_rand(),

true

));

$uuid = substr($chars,0,8) .

'-'

;

$uuid .= substr($chars,8,4) .

'-'

;

$uuid .= substr($chars,12,4) .

'-'

;

$uuid .= substr($chars,16,4) .

'-'

;

$uuid .= substr($chars,20,12);

return

$uuid;

}

原文地址:https://www.cnblogs.com/justinsun/p/2151404.html