最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
修改thinkphp3.1.3验证码图片的代码
时间:2022-06-25 02:32:14 编辑:袖梨 来源:一聚教程网
代码如下
| 代码如下 | 复制代码 |
|
“static function buildImageVerify($length=4, $mode=1, $type='png', $width=80, $height=30, $verifyName='verify') { import('ORG.Util.String'); $randval = String::randString($length, $mode); session($verifyName, md5($randval)); $width = ($length * 10 + 10) > $width ? $length * 10 + 10 : $width; $fontcolor=C('fontcolor'); if ($type != 'gif' && function_exists('imagecreatetruecolor')) { $im = imagecreatetruecolor($width, $height); } else { $im = imagecreate($width, $height); } $r = Array(225, 255, 255, 223); $g = Array(225, 236, 237, 255); $b = Array(225, 236, 166, 125); $key = mt_rand(0, 3);
$borderColor = imagecolorallocate($im, 255, 255, 255); //边框色 imagefilledrectangle($im, 0, 0, $width - 1, $height - 1, $backColor);//着色 imagerectangle($im, 0, 0, $width - 1, $height - 1, $borderColor); $stringColor = imagecolorallocate($im, mt_rand(0, 200), mt_rand(0, 120), mt_rand(0, 120)); // 干扰 for ($i = 0; $i $color = imagecolorallocate($im,mt_rand(0, 255), mt_rand(0, 255), mt_rand(0, 255)); imagesetthickness($im,2); imageline($im,mt_rand(0,$width),mt_rand(0,$height),mt_rand(0,$width),mt_rand(0,$height),$color); }
imagesetpixel($im, mt_rand(0, $width), mt_rand(0, $height), $stringColor); } //字体显示的位置和颜色 for ($i = 0; $i imagestring($im,50,$i*10+20,8,$randval{$i},$fontcolor); } //www.111com.net 雪花 for ($i=0;$i $color = imagecolorallocate($im,mt_rand(0,255),mt_rand(0,255),mt_rand(0,255)); imagestring($im,mt_rand(1,5),mt_rand(0,$width-1),mt_rand(0,$height-1),mt_rand(1,9),$color); } Image::output($im, $type); } |
|
将文件中的此部分替换就可以了
相关文章
- 污污漫画入口风险警示-合规访问指南与安全指引 12-13
- 海棠文学城网页版官网入口-2025在线网址直达 12-13
- 土豪漫画官方APP免费下载入口-正版无广告畅读保障 12-13
- 歪歪漫画app最新版下载入口-首页畅读无广告直接进 12-13
- SkrBT磁力官网最新入口-skrbt磁力引擎极速版入口 12-13
- 微博热搜网页版极速入口-微博热搜榜官方直达链接 12-13