1. PHP can read random strings. This Code creates a readable string that is closer to words in the dictionary, it is practical and has the password verification function. /************** @ Length-length of random string (must be a multiple of 2) * ************/function readable_random_string ($ length = 6) {$ conso = array ("B", "C ", "D", "F", "g", "H", "J", "k", "L", "M", "n", "P ", "r", "S", "T", "V", "W", "X", "Y", "Z "); $ vocal = array ("A", "E", "I", "O", "U"); $ Password = ""; srand (double) microtime () * 1000000); $ max = $ length/2; for ($ I = 1; $ I <= $ Max; $ I ++) {$ password. = $ conso [rand (0, 19)]; $ Pa Ssword. = $ vocal [rand (0, 4)];} return $ password;} 2. PHP generates a random string. If you do not need a readable string, you can use this function to create a random string as your random password. /************* @ L-length of random string */function generate_rand ($ L) {$ c = "Callback "; srand (double) microtime () * 1000000); For ($ I = 0; $ I <$ L; $ I ++) {$ Rand. = $ C [rand () % strlen ($ C)];} return $ rand;}