时间:2021-07-01 10:21:17 帮助过:9人阅读
[PHP]代码
function random($length)
{
$hash = ;
$chars = ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz;
$max = strlen($chars) - 1;
mt_srand((double)microtime() * 1000000);
for($i = 0; $i < $length; $i++)
{
$hash .= $chars[mt_rand(0, $max)];
}
return $hash;
}
http://www.bkjia.com/PHPjc/486024.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/486024.htmlTechArticle可以自定义产生什么字符串以及多长 [PHP]代码 function random($length) { $hash = ; $chars = ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz; $max = st...