Joke Collection Website - Public benefit messages - How does php implement verification code?

How does php implement verification code?

Reflections on the realization of verification code function mechanism

Traditional verification code implementation:

A, generating pictures of png

B, set the background color for the picture.

C, set the font color and style

D. generate a 4-digit random verification code.

E. adjust the rotation angle and position of each generated character and draw it on the png picture.

F, add noise and interference lines to prevent the registration machine from maliciously registering by analyzing the original image.

G. output the picture.

H. release the memory occupied by the picture.

I. Save the verification code to the session or database.

J, compare with the input verification code.

SMS (email) verification code mechanism:

A, generating a random verification code with 4-6 digits

B. Save each generated character to the session or database.

C, sending the verification code to the user's mobile phone (mailbox).

D, the user inputs within the specified time.

E. take out the verification code from the session or database.

F, comparing and verifying with the input verification code.