PHP automatically generates a random password & lt ;? Phpfunctionrand_string ($ len16, $ keyword) {if (strlen ($ keyword) & gt; $ len) {the keyword cannot be longer than the total length returnfalse;} $ str; $ charsabcd PHP automatically generates random passwords
$ Len) {// The keyword cannot be longer than the total length. return false;} $ str = ''; $ chars = 'abcdefghijkmnpqrstuvwxyz23456789abcdefghijkmnpqrstuvwxyz '; // remove 1 and letter l anti-obfuscation if ($ len> strlen ($ chars) {// The number of digits that are too long to repeat the string for a certain number of times $ chars = str_repeat ($ chars, ceil ($ len/strlen ($ chars) ;}$ chars = str_shuffle ($ chars); // disrupt the string $ str = substr ($ chars, 0, $ len); if (! Empty ($ keyword) {$ start = $ len-strlen ($ keyword); $ str = substr_replace ($ str, $ keyword, mt_rand (0, $ start ), strlen ($ keyword); // Insert keywords from random locations} return $ str;} echo rand_string (16, "AB"); // output example: V8bNY6SmkeywordB?>
?