PHP code example of ruiorz / captcha
1. Go to this page and download the library: Download ruiorz/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/ */
ruiorz / captcha example snippets
# click captcha:
$captcha = new \Ruiorz\Captcha\Click\ClickCaptcha();
$result = $captcha->draw();
# or math captcha:
$captcha = new \Ruiorz\Captcha\Math\MathCaptcha();
$result = $captcha->draw();
# result:
print_r($result->getCaptchaData())
print_r($result->getImageByte())
print_r($result->getImageBase64())
# click captcha:
$config = new \Ruiorz\Captcha\Click\ClickCaptchaConfig();
$config->setFontPath('src/Click/fonts/msyh.ttc');
$config->setImagePath('src/Click/images/3.jpg');
$config->setVerifyLength(3);
$result = (new \Ruiorz\Captcha\Click\ClickCaptcha($config))->draw();
print_r($result->getCaptchaData());
# or math captcha:
$config = new \Ruiorz\Captcha\Math\MathCaptchaConfig();
$config->setFontPath('src/Math/fonts/Bitsumishi.ttf');
$result = (new \Ruiorz\Captcha\Math\MathCaptcha($config))->draw();
print_r($result->getCaptchaData());