PHP generates random string functions .? Php *** generates a random string ** to generate a random string of the specified length, and returns it to the user ** @ accesspublic * @ paramint $ len to generate the string's number of digits * @ returnstring * functionra
/**
* Generate random strings
*
* Generates a random string of the specified length and returns it to the user.
*
* @ Access public
* @ Param int $ len: number of digits of the string generated
* @ Return string
*/
Function randStr ($ len = 6 ){
$ Chars = 'abdefghjklmnpqrstvwxyabdefghijkmnpqrstvwxy23456789 # % * '; // characters to build the password from
Mt_srand (double) microtime () * 1000000 * getmypid (); // seed the random number generater (must be done)
$ Password = '';
While (strlen ($ password) <$ len)
$ Password. = substr ($ chars, (mt_rand () % strlen ($ chars), 1 );
Return $ password;
}
?>
Http://www.bkjia.com/PHPjc/317275.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/317275.htmlTechArticle? Php/*** generate a random string ** to generate a random string of the specified length, and return it to the user ** @ accesspublic * @ paramint $ len to generate the string's digits * @ returnstring */functionra...