It is a headache to think about passwords one by one when creating a large number of users. Using php to randomly generate a secure and reliable password is convenient and fast, and you can add your own strings, it can be used in FTP password, Mysql password, and website
It is a headache to think about passwords one by one when creating a large number of users. Using php to randomly generate a secure and reliable password is convenient and fast, and you can add your own strings, it can be used in FTP password, Mysql password, and website
Implement the code and copy it out of the box:
Header ("Content-type: text/html; charset = UTF-8 ");
Function getRandPass ($ length = 6 ){
$ Password = '';
// Add the desired character to the following string. The default value is 0-9 and 26 English letters.
$ Chars = "0123456789 abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ ";
$ Char_len = strlen ($ chars );
For ($ I = 0; $ I <$ length; $ I ++ ){
$ Loop = mt_rand (0, ($ char_len-1 ));
// Use this string as an array, randomly retrieve a character, and concatenate it into the number of digits you need.
$ Password. = $ chars [$ loop];
}
Return $ password;
}
Echo getRandPass (12); // generate a random 12-digit password
?>