Home >Backend Development >PHP Tutorial >一个产生随机密码的函数_PHP

一个产生随机密码的函数_PHP

WBOY
WBOYOriginal
2016-06-01 12:36:26822browse

一个产生随机密码的函数




function MakePass($length)
{
$possible = "0123456789!@#$%^&*()_+".
             "abcdefghijklmnopqrstuvwxyz".
             "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
$str = "";
while(strlen($str) {
  $str .= substr($possible, (rand() % strlen($possible)), 1);
}
return($str);
}
?>  

原作者:KobraPHP  
来源:http://www.evilwalrus.com
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn