Speaking of verification code, I believe everyone is familiar with it. In our daily development work, verification code should be used in too many places, such as user login, user registration, etc. It can prevent malicious forms Registration or submission to prevent malicious cracking of passwords, ticket swiping, page swiping, etc. Verification codes can also reduce server pressure. Today I will explain to you how to call the verification code class.
Everyone knows that in the php verification code, there are functions such as creating pictures, setting interference elements, adding arcs, etc. The advantage of the verification code class is that we do not need to do these. We only need to add php After downloading the verification code class, you can call it directly!
First download the php verification code class we need for this section: //m.sbmmt.com/xiazai/leiku/819
Then Save the downloaded file (captcha.class.php) to our local server, and then we create a php file to call the php verification code class:
<?php require_once 'captcha.class.php'; //引入php验证码类 $captcha = new Captcha(100,50,4);//实例化该类(后面的是验证码的宽、高、验证码的个数) $captcha->showImg(); //输出验证码图片
The result of running this file is as follows:
Note:
Every time you run or refresh this page, the verification you get is incorrect. the same.
The above is the detailed content of Tutorial on calling text of PHP verification code class. For more information, please follow other related articles on the PHP Chinese website!