Custom PHP Verification code for use development sharing

Source: Internet
Author: User
Last lesson we introduced the PHP code style of use, about the PHP verification code I believe you have been very familiar with, many places are related to the function of verification code, there are many of the online, for the production of verification code is also very familiar with, the first to create a canvas, after that is to add strings for the canvas, line , noise, border, to generate a verification code, today to introduce you to customize the verification code!


First step: First download the PHP Verification code class that we need in this section: http://www.php.cn/xiazai/leiku/456

Second step: Then save the downloaded PHP file class library to our local server, and then we create a PHP file!

Step Three: Finally call this class in this new file, and instantiate the class:

<?phpinclude_once "yzm.php"; Introduce class file $obj = new Authnum ();    Instantiate $obj->ext_num_type= "; $obj->ext_pixel = true; Interference point $obj->ext_line = false; Interference line $obj->ext_rand_y= true; Y-Axis random $obj->green = 238;      Background color $obj->create ();         Output Image?>

The results of the operation are as follows:

Attention:

1. When instantiating an object ($obj = new Authnum ()), the parameters after Authnum () are: Verification code length, picture width, picture height, you can fill out, you can choose the default!

2. each time you run or refresh this page, you will get a different verification.

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.