PHP code example of tp5 / captcha

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

    

tp5 / captcha example snippets


$this->validate($data,[
    'captcha|验证码'=>'

captcha_check($phrase);

[
    'captcha' => [
        'verify_ip' => false, // 是否验证ip匹配
        'zh' => false, // 是否使用中文验证码
        'timeout' => 300, // 验证码的过期时间,单位秒
        'width' => 150, // 验证码图片宽度
        'height' => 40, // 验证码图片宽度高度
        'prefix' => 'captcha', // 验证码session前缀
        'detect_case' => false, // 是否区分大小写
        'force_refresh' => true, // 验证后是否刷新验证码
    ]
]

echo captcha_img($class = '')