This article describes how to generate a random string using the specified character list in php. It involves the skills related to the rand, substr, and other functions in php to operate on strings. It is very simple and practical. For more information, see
This article describes how to generate a random string using the specified character list in php. It involves the skills related to the rand, substr, and other functions in php to operate on strings. It is very simple and practical. For more information, see
This example describes how php uses the specified character list to generate a random string. Share it with you for your reference. The details are as follows:
<? Phpfunction randomString ($ len) {srand (date ("s"); $ possible = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890! @ # $ % ^ & * () "; $ Str =" "; while (strlen ($ str) <$ len) {$ str. = substr ($ possible, (rand () % (strlen ($ possible), 1) ;}return ($ str) ;}?>
I hope this article will help you with php programming.
,