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.