PHP code example of lyhiving / mcaptcha
1. Go to this page and download the library: Download lyhiving/mcaptcha 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/ */
lyhiving / mcaptcha example snippets
use lyhiving\mCaptcha\mCaptcha;
$captch = new mCaptcha();
$captch->init([
'width' => 160, // 宽度
'height' => 50, // 高度
'line' => false, // 直线
'curve' => true, // 曲线
'noise' => 1, // 噪点背景
'fonts' => [] // 字体
]);
$captch->create();
$captch->output(1);
$captch->save('1.png',1);
$_SESSION['captch'] = $captch->getText();