php生成随机密码函数示例
时间:2021-07-01 10:21:17
帮助过:14人阅读
- #生成随机密码
- function MakePass($length)
- {
- $possible = "0123456789!@#$%^&*()_+".
- "abcdefghijklmnopqrstuvwxyz".
- "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
- $str = "";
- while(strlen($str) < $length)
- {
- $str .= substr($possible, (rand() % strlen($possible)), 1);
- }
- return($str);
- }
|