Joke Collection Website - Public benefit messages - How to realize the verification function of java mobile phone short message

How to realize the verification function of java mobile phone short message

I won't talk about the function of texting. Check it yourself.

1. generates a series of random numbers, then sends them to that mobile phone number, and then uses the mobile phone number as a key to store the random numbers in redis, and sets the expiration time (usually about one hour).

2. After receiving the short message, the user enters the verification code in the page, and then goes to the background to take out the previously stored random number verification code according to the user's mobile phone number for comparison. If they are consistent, pass, otherwise the verification code is wrong.