PHP 创建GUID唯一标识
程序员文章站
2022-05-18 23:27:40
function createGuid() { mt_srand((double)microtime()*10000); $charid = strtoupper(md5(uniqid(mt_srand(), true))); $hyphen = chr(45); $uuid = substr($c ......
function createguid() { mt_srand((double)microtime()*10000); $charid = strtoupper(md5(uniqid(mt_srand(), true))); $hyphen = chr(45); $uuid = substr($charid, 0, 8) . $hyphen . substr($charid, 8, 4) . $hyphen . substr($charid,12, 4) . $hyphen . substr($charid,16, 4) . $hyphen . substr($charid,20,12); return $uuid; } echo createguid(); // 8929e377-74f8-3dec-4a86-2e5289a8327f