100字范文,内容丰富有趣,生活中的好帮手!
100字范文 > php完整验证码代码 php 生成验证码 php 短信验证码 php验证码代

php完整验证码代码 php 生成验证码 php 短信验证码 php验证码代

时间:2019-07-05 02:27:57

相关推荐

php完整验证码代码 php 生成验证码 php 短信验证码 php验证码代

后端开发|php教程

php,验证码

后端开发-php教程

母亲节网站源码,vscode文件分组,ubuntu刻录到光盘,tomcat配置好了,sqlite新建列表,php图表插件,前端那三大框架,爬虫调取数据,php post php,SEO分析图配色,交友 婚姻 网站源码,扁平化透明网页,discuz utf8 免费模板, 弹出页面悬浮,按揭管理系统源码,优惠券网站 程序lzw

<?php require_once string.func.php;//通过GD库做验证码/** *添加验证文字 * @param int $type * @param int $length*/function buildRandomString($type=1,$length=4){ $row=\; if($type==1){ $row=join(\,range(0, 9)); }elseif($type==2){ $row=join(\, array_merge(range(a,z),range(A, ))); }elseif($type==3){ $row=join(\, array_merge(range(a,z),range(A, ),range(0, 9))); }; $row=str_shuffle($row); $row=substr($row,0,$length); return$row;}/** * 生成缩略图 * @param int $type //包含数字或者英文 * @param int $length 多少个字符 * @param int $pixel 干扰小点的密度 * @param int $dst_h 干扰线的密度 * @param string //验证码在$_SESSION中的名字 */function verifyImage($type=1,$length=4,$pixel=0,$line=0,$sess_name = "verify"){ //session_start(); //创建画布$width = 100; $height = 40; $image = imagecreatetruecolor ( $width, $height ); $white = imagecolorallocate ( $image, 255, 255, 255 ); $black = imagecolorallocate ( $image, 0, 0, 0 ); //用填充矩形填充画布 imagefilledrectangle ( $image, 1, 1, $width - 2, $height - 2, $white ); $chars = buildRandomString ( $type, $length ); $_SESSION [$sess_name] = $chars; //$fontfiles = array ("MSYH.TTF", "MSYHBD.TTF", "SIMLI.TTF", "SIMSUN.TTC", "SIMYOU.TTF", "STZHONGS.TTF" );$fontfiles = array ("SIMKAI.TTF" ); //由于字体文件比较大,就只保留一个字体,如果有需要的同学可以自己添加字体,字体在你的电脑中的fonts文件夹里有,直接运行输入fonts就能看到相应字体for($i = 0; $i < $length; $i ++) { $size = mt_rand ( 14, 18 ); $angle = mt_rand ( - 15, 15 ); $x = 5 + $i * $size; $y = mt_rand ( 20, 26 ); $fontfile = "../fonts/" . $fontfiles [mt_rand ( 0, count ( $fontfiles ) - 1 )]; $color = imagecolorallocate ( $image, mt_rand ( 50, 90 ), mt_rand ( 80, 200 ), mt_rand ( 90, 180 ) ); $text = substr ( $chars, $i, 1 ); imagettftext ( $image, $size, $angle, $x, $y, $color, $fontfile, $text ); } if ($pixel) { for($i = 0; $i < 50; $i ++) { imagesetpixel ( $image, mt_rand ( 0, $width - 1 ), mt_rand ( 0, $height - 1 ), $black ); } } if ($line) { for($i = 1; $i < $line; $i ++) { $color = imagecolorallocate ( $image, mt_rand ( 50, 90 ), mt_rand ( 80, 200 ), mt_rand ( 90, 180 ) ); imageline ( $image, mt_rand ( 0, $width - 1 ), mt_rand ( 0, $height - 1 ), mt_rand ( 0, $width - 1 ), mt_rand ( 0, $height - 1 ), $color ); } } header ( "content-type:image/gif" ); imagegif ( $image ); imagedestroy ( $image );}

分站群源码,ubuntu中关于fPCI,python爬虫如何滚动,php 提取英文,seo提案需求lzw

主要要点:1、如果前面没有申明session_start();则需要申明;2、字体可以在cmf输入fonts下载到自己定义的fonts文件夹;3、$_SESSION [$sess_name]可以通过$_POST获得用户输入的验证码进行比较。

易语言屏幕录制源码,vscode切换菜单,ubuntu还原默认网络设置,tomcat上发布,后缀为sqlite文件,wordpress伪静态 插件,php框架前端写在哪,爬虫维生素,股票 php,seo粤语是什么意思,php新闻网站代码,html5简单网页模板,帝国网模板下载,蓝天白云大气的动画404页面模板下载,内容管理系统多站点开源,京东微信小程序下单白条付款lzw

以上就介绍了php完整验证码代码,包括了php,验证码方面的内容,希望对PHP教学有兴趣的朋友有所帮助。

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