This article mainly introduces the method of PHP to obtain 6-digit random numbers that do not exist in redis. It can set a 24-hour expiration limit and involves PHP string and database related operation skills. Friends who need it can refer to it
PHP Gets a 6-digit random number
PHP str_shuffle()
Function
str_shuffle() function randomly shuffles Garble all characters in the string.
Parameter Description | |
---|---|
Required. Specifies the string to be scrambled. |
1 2 3 4 |
|
Example: Get redis A 6-digit random number that does not exist in it (set to expire in 24 hours)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
|
Related recommendations:
php generatesrandom numberscharacters, letters or mixed strings of numbers and letters
Random numbers and detailed explanation of random sequence methods
##What PHP generates
The above is the detailed content of How to get a 6-digit random number that does not exist in redis with PHP. For more information, please follow other related articles on the PHP Chinese website!