PHP Generate CAPTCHA code example _php Tutorial

Source: Internet
Author: User
The following is the generation of code codes, the results of programming home site test, no errors posted. If there is something that you do not understand, the programming house will explain what you don't understand. I hope I can get something for you.

    1. Session_Start ();
    2. $nums = rand (1000,9999);
    3. $_session[nums]= $nums;
    4. $imgs = Imagecreatetruecolor (100, 35);
    5. $one = imagecolorallocate ($imgs, 0, 0, 0);
    6. $two = Imagecolorallocate ($imgs, rand (0, 255), rand (0, 255), rand (0, 255));
    7. $thr = Imagecolorallocate ($imgs, rand (+), rand (+, 255), Rand (150, 255));
    8. Imagestring ($imgs, 6, Rand (5), Rand (3,), $nums, $two);
    9. for ($i = 1; $i <= 3; $i) {
    10. Imageline ($imgs, rand (0, 0), rand (0, +), rand (0, +), $thr);
    11. }
    12. for ($i = 1; $i <=; $i) {
    13. Imagesetpixel ($imgs, Rand () 0,rand () 5, $two);
    14. }
    15. Header ("Content-type:image/jpeg");
    16. Imagejpeg ($IMGS);
    17. ?>

http://www.bkjia.com/PHPjc/486153.html www.bkjia.com true http://www.bkjia.com/PHPjc/486153.html techarticle The following is the generation of code codes, the results of programming home site test, no errors posted. If there is something that you do not understand, the programming house will explain what you don't understand. ...

  • 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.