方法一:
function generateUUid($strtoupper = false){
$charid = call_user_func($strtoupper ? 'strtoupper' : 'strtolower', md5(uniqid(microtime(true), 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;
}
方法二:
function generateUid(){
return call_user_func('str_shuffle', time());
}