Also sends a random string generation function
<无详细内容>
- /**
- * Generate a random number
- *
- * @ Param int $ length: generate the string length
- * @ Param int $ type string type
- * @ Param bool $ special whether to use special characters
- * @ Return string returns the generated random string.
- * @ Example random (10, null, true );
- */
- Function random ($ length, $ type = NULL, $ special = FALSE ){
- $ Str = "";
- Switch ($ type ){
- Case 1:
- $ Str = "0123456789 ";
- Break;
- Case 2:
- $ Str = "abcdefghijklmnopqrstuvwxyz ";
- Break;
- Case 3:
- $ Str = "ABCDEFGHIJKLMNOPQRSTUVWXYZ ";
- Break;
- Case 4:
- $ Str = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 ";
- Break;
- Default:
- $ Str = "abcdefghijkmnpqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ23456789 ";
- Break;
- }
- Return substr (str_shuffle ($ special! = FALSE )? '! @ # $ % ^ & * () _ + '. $ Str: $ str), 0, $ length );
- }
|