失眠网,内容丰富有趣,生活中的好帮手!
失眠网 > php生成验证码 缩略图及水印图的类实例详解

php生成验证码 缩略图及水印图的类实例详解

时间:2022-11-09 21:03:28

相关推荐

php生成验证码 缩略图及水印图的类实例详解

后端开发|php教程

php,实例,水印

后端开发-php教程

这篇文章主要给大家分享的是php生成验证码,缩略图,及水印图的类,十分的实用,有需要的小伙伴可以参考下

首轮影院源码,vscode分辨大小写吗,ubuntu 加载pci,idea建不了tomcat,厕所总有爬虫,goeasy php,浦城搜索引擎seo排名lzw

<?phpclass image{ session_start(); //验证码类 static public function verify($code,$width=75,$height=25,$n=4){ header("content-type:image/png"); // 创建画布 $img=imagecreatetruecolor($width,$height); // 设置背景色 $bgcolor=imagecolorallocate($img,mt_rand(200,255),mt_rand(200,255),rand(200,255)); // 将背景色填充 imagefill($img,0,0,$bgcolor); // 绘制五条弧线 for($i=0;$i<5;$i++){$arccolor=imagecolorallocate($img,mt_rand(200,255),mt_rand(200,255),rand(200,255));imagearc($img,mt_rand(5,($width-5)),mt_rand(5,($height-5)),mt_rand(5,($width-5)),mt_rand(5,($height-5)),mt_rand(0,360),mt_rand(0,360),$arccolor); } // 绘制一百个点 for($i=0;$i<100;$i++){$pixelcolor=imagecolorallocate($img,mt_rand(200,255),mt_rand(200,255),rand(200,255));imagesetpixel($img,mt_rand(1,($width-1)),mt_rand(1,($height-1)),$pixelcolor); } // 绘制五条线段 for($i=0;$i<5;$i++){$linecolor=imagecolorallocate($img,mt_rand(200,255),mt_rand(200,255),rand(200,255));imageline($img,mt_rand(1,($width-1)),mt_rand(1,($height-1)),mt_rand(1,($width-1)),mt_rand(1,($height-1)),$linecolor); } // 设置边框颜色 $bdcolor=imagecolorallocate($img,mt_rand(150,200),mt_rand(150,200),rand(150,200)); // 绘制一个矩形无填充边框 imagerectangle($img,0,0,($width-1),($height-1),$bdcolor); // 设置验证码字符串 $str=\; for($i=1;$i<=$n;$i++){$str.=substr(str_shuffle($code),0,1); } $_SESSION[a]=$str; // for($i=0;$i

总结:

h5场景模板源码下载,ubuntu语言转换,局域网下tomcat启动,登录爬虫系统,PHP租号网源码,株洲专业seo优化成交价lzw

asp 打开为源码,ubuntu qt导入图片,tomcat中的log4j2,python爬虫爬游戏,php运算符和变量的声明,低价seo费用lzw

如果觉得《php生成验证码 缩略图及水印图的类实例详解》对你有帮助,请点赞、收藏,并留下你的观点哦!

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。