700字范文,内容丰富有趣,生活中的好帮手!
700字范文 > (进阶篇)php生成验证码程序代码

(进阶篇)php生成验证码程序代码

时间:2021-11-20 05:23:56

相关推荐

(进阶篇)php生成验证码程序代码

后端开发|php教程

php,生成验证码

后端开发-php教程

以下正文:

源码之家 python,vscode安装包解压后,ubuntu版本高低,tomcat端口的改写,梦见扁形爬虫,php 数据管理系统,大商新玛特官网seo,网站安全代码lzw

新建一个PHP文件captcha_code_file.php

好的源码站,ubuntu安装引导指令,tomcat会话数最大值,爬虫软件价位,php页面数据库修改,seo模型解说lzw

//首先开启sessionsession_start();//定义前台显示验证码长&宽$image_width = 120;$image_height = 40;$characters_on_image = 6;$font = ./monofont.ttf;//The characters that can be used in the CAPTCHA code.//avoid confusing characters (l 1 and i for example)$possible_letters = 23456789bcdfghjkmnpqrstvwxyz;$random_dots = 10;$random_lines = 30;$captcha_text_color="0x142864";$captcha_noice_color = "0x142864";//定义要生成验证码的字符串$code = \;$i = 0;while ($i < $characters_on_image) { $code .= substr($possible_letters, mt_rand(0, strlen($possible_letters)-1), 1);$i++;}$font_size = $image_height * 0.75;$image = @imagecreate($image_width, $image_height);/* setting the background, text and noise colours here */$background_color = imagecolorallocate($image, 255, 255, 255);$arr_text_color = hexrgb($captcha_text_color);$text_color = imagecolorallocate($image, $arr_text_color[ ed], $arr_text_color[green], $arr_text_color[lue]);$arr_noice_color = hexrgb($captcha_noice_color);$image_noise_color = imagecolorallocate($image, $arr_noice_color[ ed], $arr_noice_color[green], $arr_noice_color[lue]);/* generating the dots randomly in background */for( $i=0; $i<$random_dots; $i++ ) {imagefilledellipse($image, mt_rand(0,$image_width), mt_rand(0,$image_height), 2, 3, $image_noise_color);}/* generating lines randomly in background of image */for( $i=0; $i 0xFF & ($int >> 0x10),"green" => 0xFF & ($int >> 0x8),"blue" => 0xFF & $int);}

c 数据库源码之家,ubuntu 电池不充电,tomcat部署服务器上,人人网爬虫登录,php网站外包收费标准教程,seo9800lzw

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