密码随机函数_PHP教程
程序员文章站
2022-05-30 10:03:39
...
function make_password()
{$pw_length=24;//密码长度
$low_ascii_bound=50;
$upper_ascii_bound=122;
$notuse=array(58,59,60,61,62,63,64,73,79,91,92,93,94,95,96,108,111);
while($i {mt_srand((double)microtime()*1000000);
$randnum=mt_rand($low_ascii_bound,$upper_ascii_bound);
if(!in_array($randnum,$notuse))
{$password1=$password1.chr($randnum);
$i ;
}
}
return $password1;}
$password=make_password();//调用
?>
{$pw_length=24;//密码长度
$low_ascii_bound=50;
$upper_ascii_bound=122;
$notuse=array(58,59,60,61,62,63,64,73,79,91,92,93,94,95,96,108,111);
while($i {mt_srand((double)microtime()*1000000);
$randnum=mt_rand($low_ascii_bound,$upper_ascii_bound);
if(!in_array($randnum,$notuse))
{$password1=$password1.chr($randnum);
$i ;
}
}
return $password1;}
$password=make_password();//调用
?>
上一篇: PHP array_flip() 删除重复数组元素专用函数_php技巧
下一篇: PHP正则详解