一: 数字+字符串
substr(md5(uniqid(rand(),1)), 8, 16); //16位
二:数字
time(). str_pad(mt_rand(1, 999999999), 5, '0', STR_PAD_LEFT);
三:数字+字符串(自己可以组合)
function str_rand($length=32,$characters='0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ')
{
if(!is_int($length)||$length<0){
return false;
}
$characters_length=strlen($characters)-1;
$string='';
for($i=$length;$i>0;$i--){
$string.=$characters[mt_rand(0,$characters_length)];
}
return $string;
}