Learning php's simplest verification code production

Source: Internet
Author: User
: This article mainly introduces how to create the simplest verification code of php. if you are interested in the PHP Tutorial, refer to it. I am a computer student about to go out for an internship. I have learned some simple things about php. Today, I sent my verification code for your advice. The code is as follows:
 $ Red1, '1' => $ green1, '2' => $ blue1); // fill the canvas background color imagefill ($ img, 0, 0, $ bgcolor ); // add the verification code content for ($ I = 0; $ I <4; $ I ++) {$ content. = ''; $ c} imagestring ($ img, 40, 20, 10, $ content, $ col [rand (0, 2)]); // add interference factors // add interference points for ($ I = 0; $ I <50; $ I ++) {imagesetpixel ($ img, rand ), rand (), $ col [rand ()]);} // add interference line for ($ j = 0; $ j <4; $ j ++ ){
// Imageline function format: imageline (image, x1, y1, x2, y2, color); imageline ($ img, rand (), rand ), rand (), rand (), $ col [rand ()]);} // output image imagepng ($ img ); // release the image resource imagedestroy ($ img);?>

Zookeeper

The above describes how to prepare the most simple php verification code, including the content, and hope to be helpful to friends who are interested in PHP tutorials.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.