PHP code example of lifei6671 / php-captcha

1. Go to this page and download the library: Download lifei6671/php-captcha library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

lifei6671 / php-captcha example snippets



use Minho\Captcha\CaptchaBuilder;

$captch = new CaptchaBuilder();

$captch->initialize([
    'width' => 150,     // 宽度
    'height' => 50,     // 高度
    'line' => false,    // 直线
    'curve' => true,    // 曲线
    'noise' => 1,       // 噪点背景
    'fonts' => []       // 字体
]);

$captch->create();


$captch->output(1);



$captch->save('1.png',1);



$_SESSION['captch'] = $captch->getText();
json
{
    "  "lifei6671/php-captcha": "0.1.*"
    }
}