Joke Collection Website - Public benefit messages - Where is the verification code generally stored after PHP sends it?

Where is the verification code generally stored after PHP sends it?

After sending the verification code, the user is allowed to perform the next step on another page, which may be another session, so it is not appropriate to save it in the same session.

After sending the verification code, the user is also allowed to have a certain operation time limit, such as being valid within 24 hours. Then you have to ensure that the user enters the same verification code within 24 hours and it must work. Generally, redis is only used as a buffer database without persistence. Restarting will cause the saved data to be lost. A large amount of buffered data may also overwrite old data, and the availability of the verification code cannot be guaranteed.

So, storing it in a durable database is a safer approach. Mysql is ok, of course Redis can also be persisted