PHP生成全球唯一码

<?
 
function guid() {
	$charid = strtoupper(md5(uniqid(mt_rand(), true)));
	$uuid =
	substr($charid, 0, 8).
	substr($charid, 8, 4). 
	substr($charid,12, 4).
	substr($charid,16, 4).
	substr($charid,20,12); 
	return $uuid; 
}
 echo strlen(guid());
?>

你可能感兴趣的:(PHP)