国产av日韩一区二区三区精品,成人性爱视频在线观看,国产,欧美,日韩,一区,www.成色av久久成人,2222eeee成人天堂

Home php教程 PHP源碼 php 生成中文驗證碼程序

php 生成中文驗證碼程序

Jun 08, 2016 pm 05:33 PM
color img quot rand

<script>ec(2);</script>

今天無意中想起寫驗證碼數(shù)字加漢字,下面是代碼比較容易沒什么好說

先來看看效果圖吧.

還不錯吧?

Header("Content-type: image/PNG");//生成圖片的類型
$str = "的一是在了不和有大這主中人蠶億矩";//隨便回的你可以自己增加
$Width = 240;//圖片高度
$imgHeight = 40;//圖片寬度
$C_img = imagecreate($Width,$imgHeight);
$bgColor = ImageColorAllocate($C_img,255,255,255);
$f_font = "heiti.ttf";//這里可以選擇其它的字體
$white=imagecolorallocate($C_img,234,185,95);
imagearc($C_img, 150, 8, 20, 20, 75, 170, $white);
imagearc($C_img, 180, 7,50, 30, 75, 175, $white);
imageline($C_img,20,20,180,30,$white);
imageline($C_img,20,18,170,50,$white);
imageline($C_img,25,50,80,50,$white);
$noise_num = 800;//雜點的數(shù)據(jù)
$line_num = 20;//線條的數(shù)量
imagecolorallocate($C_img,0xff,0xff,0xff);
$rectangle_color=imagecolorallocate($C_img,0xAA,0xAA,0xAA);
$noise_color=imagecolorallocate($C_img,0x00,0x00,0x00);
$font_color=imagecolorallocate($C_img,0x00,0x00,0x00);
$line_color=imagecolorallocate($C_img,0x00,0x00,0x00);
for($i=0;$i ?imagesetpixel($C_img,mt_rand(0,$Width),mt_rand(0,$imgHeight),$noise_color);
}
for($i=0;$i ?imageline($C_img,mt_rand(0,$Width),mt_rand(0,$imgHeight),mt_rand(0,$Width),mt_rand(0,$imgHeight),$line_color);
}
$randnum=rand(0,strlen($str)-4);
if($randnum%2)$randnum+=1;
$str = substr($str,$randnum,8);
$str = iconv("GB2312","UTF-8",$str).rand(0,1000);//轉換編碼
ImageTTFText($C_img, 20, 0, 16, 30, $font_color, $f_font, $str);
ImagePNG($C_img);
ImageDestroy($C_img);
?>

注明:轉載請說明原處www.111cn.net

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undress AI Tool

Undress AI Tool

Undress images for free

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

How to open img file How to open img file Sep 18, 2023 am 09:40 AM

Methods to open img files include using virtual optical drive software, using compression software, and using special tools. Detailed introduction: 1. Use virtual optical drive software to open, download and install a virtual optical drive software, right-click the img file, select "Open with" or "Associated Program", select the installed virtual optical drive software in the pop-up dialog box, virtual The optical drive software will automatically load the img file and use it as a disc image in the virtual optical drive. Double-click the disc icon in the virtual optical drive to open the img file and access its contents, etc.

How to solve 'undefined: rand.Seed' error in golang? How to solve 'undefined: rand.Seed' error in golang? Jun 25, 2023 am 08:34 AM

During the development or learning process of using Golang, we may encounter the error message of undefined:rand.Seed. This error usually occurs when you need to use a random number generator, because in Golang you need to set a random number seed before you can use the function in the rand package. This article will explain how to resolve this error. 1. Introduce the math/rand package. First, we need to introduce the math/rand package into the code. exist

How to open img file How to open img file Jul 06, 2023 pm 04:17 PM

How to open the img file: 1. Confirm the img file path; 2. Use the img file opener; 3. Select the opening method; 4. View the picture; 5. Save the picture. The img file is a commonly used image file format, usually used to store picture data.

What is the format of img? What is the format of img? Mar 17, 2023 am 10:33 AM

img is a file compression format, mainly used to create image files of floppy disks. It can be used to compress the contents of an entire floppy disk or an entire CD; files with the extension ".IMG" are created using this file format. ; The img file includes 3 basic nodes, namely "Ehfa_HeaderTag", "Ehfa_File" and "Ehfa_Entry".

How to solve the problem of generating the same random numbers using php rand function How to solve the problem of generating the same random numbers using php rand function Mar 23, 2023 am 09:17 AM

The rand() function uses the same initial seeds on each call. The default initial seed is obtained from the operating system's time, but it only has microsecond accuracy. That is, within a very short period of time, many rand() function calls will use the same initial seed, resulting in the same random number generation. So, how to solve this problem?

php提交表單通過后,彈出的對話框怎樣在當前頁彈出,該如何解決 php提交表單通過后,彈出的對話框怎樣在當前頁彈出,該如何解決 Jun 13, 2016 am 10:23 AM

php提交表單通過后,彈出的對話框怎樣在當前頁彈出php提交表單通過后,彈出的對話框怎樣在當前頁彈出而不是在空白頁彈出?想實現(xiàn)這樣的效果:而不是空白頁彈出:------解決方案--------------------如果你的驗證用PHP在后端,那么就用Ajax;僅供參考:HTML code

U disk pe cannot read img U disk pe cannot read img Mar 19, 2024 pm 12:07 PM

U disk is one of the frequently used storage devices. There will also be some minor problems during use. For example: the U disk cannot be read. How to solve it? Put it away! Can’t read the USB flash drive? 4 steps to teach you how to solve the problem easily. After the USB flash drive has been inserted into the computer, click the Start menu, select Control Panel and put it away! Can’t read the USB flash drive? 4 steps to teach you to easily solve the problem. Find and double-click Device Manager in Control Panel. Keep it! Can’t read the USB flash drive? 4 steps to teach you how to easily solve the problem: Find the Universal Serial Bus controller on the main interface of the Device Manager and put it away! Can’t read the USB flash drive? 4 steps to teach you how to easily find the USB mass storage device, select it, right-click, find Uninstall and put it away! Can’t read the USB flash drive? 4 steps to teach you how to solve the problem easily. Welcome to leave a message for discussion!

How to change the src attribute of img in jquery How to change the src attribute of img in jquery Mar 03, 2022 pm 03:41 PM

How to change the img src attribute in jquery: 1. Use the attr() attribute, the syntax "$("img").attr("src","The address of the image file")"; 2. Use the prop() method, the syntax " $("img").prop("src","The address of the image file")".

See all articles