Home >Backend Development >PHP Tutorial >Tutorial on calling text of PHP verification code class

Tutorial on calling text of PHP verification code class

黄舟
黄舟Original
2017-08-14 17:53:001376browse

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: http://www.php.cn/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 &#39;captcha.class.php&#39;; //引入php验证码类

$captcha = new Captcha(100,50,4);//实例化该类(后面的是验证码的宽、高、验证码的个数)

$captcha->showImg();           //输出验证码图片

The result of running this file is as follows:

Tutorial on calling text of PHP verification code class

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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn