PHP code example of waljqiang / captcha

1. Go to this page and download the library: Download waljqiang/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/ */

    

waljqiang / captcha example snippets



Nova\Captcha\Captcha;

$captcha = new Captcha(
            [
                'fontSize' => 18,
                'length' => 4,
                'useNoise' => false,
                'codeSet' => '0123456789',
                'imageW' => 130,
                'imageH' => 50,
                'fontttf' => '5.ttf'
            ]
        );
$code = $captcha->entry();
file_put_contents('11.txt',json_encode($code));
$captcha->getImage();

//验证
/*$code = json_decode(file_get_contents('11.txt'),true);

$captcha = new Captcha();
$rs = $captcha->check($code,'0606');
var_dump($rs);*/