Home PHP Libraries Verification code library php verification code class ValidateCode
php verification code class ValidateCode I saw on the Internet that using ValidateCode written in PHP to generate a verification code class, I feel good about it, so I used it to analyze and learn. $charset is a random factor. Here, several characters that are difficult to distinguish are removed, such as letters "i, l, o, q" and numbers "0,1". If necessary, you can add some Chinese or other characters or calculations, etc.

When generating verification code text on an image, the position of the text on the image and the color of each text are mainly considered.

Control the x-axis position of the n-th text = (image width / verification code length) * (n-1) random offset number; where n = {d1....n}

Control the y-axis position of the nth text = image height / 2 random offset number;

mt_rand(0, 156) randomly selects the text color. The purpose of 0-156 is to select a darker color.

mt_rand(-30, 30) Random text rotation.

Disclaimer

All resources on this site are contributed by netizens or reprinted by major download sites. Please check the integrity of the software yourself! All resources on this site are for learning reference only. Please do not use them for commercial purposes. Otherwise, you will be responsible for all consequences! If there is any infringement, please contact us to delete it. Contact information: admin@php.cn

Related Article

PHP verification code class ValidateCode PHP verification code class ValidateCode

04 May 2018

This article mainly provides a detailed analysis of the PHP verification code class ValidateCode, which has certain reference value. Interested friends can refer to it.

PHP verification code class ValidateCode analysis PHP verification code class ValidateCode analysis

26 May 2018

This article mainly provides a detailed analysis of the PHP verification code class ValidateCode, which has certain reference value. Interested friends can refer to it.

php complete verification code code php generate verification code php SMS verification code php verification code code php complete verification code code php generate verification code php SMS verification code php verification code code

29 Jul 2016

php, verification code: php complete verification code code: <?php require_once 'string.func.php';//Verification code through GD library/***Add verification text* @param int $type* @param int $length */function buildRandomString($type=1,$length=4){$row='';if($type==1){$row=join('',range(0, 9));}elseif( $

php verification code class php verification code php verification code class php verification code

25 Jul 2016

php verification code class php verification code

Verification code class, php verification code class_PHP tutorial Verification code class, php verification code class_PHP tutorial

12 Jul 2016

Verification code class, php verification code class. Verification code class, php verification code class. Familiar with related image processing functions, simple verification code class 1 // code class 2 class ValidateCode { 3 private $charset = 'abcdefghkmnprstuvwxyzABCDEFGHKMNP

PHP Chinese alphanumeric verification code class, customizable font_PHP tutorial PHP Chinese alphanumeric verification code class, customizable font_PHP tutorial

21 Jul 2016

PHP Chinese alphanumeric verification code class, customizable font. In actual project development, verification code problems are often encountered, such as login pages, message pages, and registration pages. The principle of verification code is very simple: use the GD library to create an image. The image must of course be

See all articles