Python has a random package, which can be implemented, such as a random string. php does not. Therefore, you have implemented a functiongenRandomString ($ len) {$ charsarray (a, B, c, d, e, f, g, h, I, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z, A, B, C, D, E, F, G, h, I,
Python has a random package, which can be implemented, such as a random string. php does not. Therefore, you have implemented a function genRandomString ($ len) {$ chars = array (a, B, c, d, e, f, g, h, I, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z, A, B, C, D, E, f, G, H, I,
Python has a random package, which can be implemented, such as a random string. php does not.
So I implemented
Function genRandomString ($ len) {$ chars = array ("a", "B", "c", "d", "e", "f", "g ", "h", "I", "j", "k", "l", "m", "n", "o", "p", "q ", "r", "s", "t", "u", "v", "w", "x", "y", "z", "", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K ", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U ", "V", "W", "X", "Y", "Z", "0", "1", "2", "3", "4 ", "5", "6", "7", "8", "9"); $ charsLen = count ($ chars)-1; shuffle ($ chars ); // disrupt the array $ output = ""; for ($ I = 0; $ I <$ len; $ I ++) {$ output. = $ chars [mt_rand (0, $ charsLen)];} return $ output ;}