php生成唯一id
function kuangke_get_uniqid($create_len = 10) /***** *作者:狂客 *QQ:214109721 *时间:2021-01-13 20:42:26 *功能:生成唯一id *参数:create_len 唯一id长度 *****/ { $code="ABCDEFGHIGKLMNOPQRSTUVWXYZ0123456789"; $codelen = strlen($code) - 1; $id = ''; for($i = 0;$i < $create_len;$i++) { $type = mt_rand(0, 2); switch($type) { case 0: $chr = uniqid(); $len = strlen($chr); $chr = substr($chr, mt_rand(0, $len - 1),1); if(is_numeric($chr)) $id .= $code[$chr]; else $id .= $chr; break; case 1: $timestamp = microtime(); $temp = str_replace(array(' ', '.', '0'), '', $timestamp); $len = strlen($temp); $chr = substr($temp, mt_rand(0, $len - 1),1); $id .= $code[mt_rand(0, $chr)]; break; default: $id .= $code[mt_rand(0, $codelen)]; break; } } return strtoupper($id); }