用php获得产生随机数的办法
网络整理 - 08-18
以下为引用的内容:
function domake_password($pw_length)
{
$low_ascii_bound=48;
$upper_ascii_bound=57;
$notuse=array(58,59,60,61,62,63,64,73,79,91,92,93,94,95,96,108,111);
while($i<$pw_length){
mt_srand((double)microtime()*1000000);
$randnum=mt_rand($low_ascii_bound,$upper_ascii_bound);
if(!in_array($randnum,$notuse)){
if ($i==0 && $randnum==0) {
$i=0;
$password1='';
domake_password(4);
}
$password1=$password1.chr($randnum);
$i++;
}
}
return $password1;
}