版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/u012972536/article/details/78678780
/**
* 生成随机密码
* @author Leven <[email protected]>
* @return string
*/
function createRegPwd()
{
$str = '';
$strPol = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz";
$max = strlen($strPol) - 1;
for ($i = 0; $i < 8; $i ++) {
$str .= $strPol{rand(0, $max)};
}
return $str;
}