摘要:composer require topthink/think-captcha安装插件config目录新建captcha.php配置<?php // 验证码配置 return [ // 验证码的字符集 'codeSet' => 
composer require topthink/think-captcha安装插件
config目录新建captcha.php配置
<?php // 验证码配置 return [ // 验证码的字符集 'codeSet' => '23456789abcdefghijklmnpqrstuvwxyz', // 字体大小 'fontSize' => 18, // 是否添加混淆曲线 'useCurve' => false, // 验证码图片宽度、高度 'imageW' => 150, 'imageH' => 35, // 验证码位数 'length' => 4, // 验证成功后重置 'reset' => true ];
验证码图片使用
<img src="{:captcha_src()}" id="img">
批改老师:西门大官人批改时间:2019-01-09 11:47:28
老师总结:这样可以完成验证码的配置。一般在正式项目中验证码如果输入错误的话,应该自动更换验证码。最好加上这个处理逻辑