php 生成中文驗證碼程序
Jun 08, 2016 pm 05:33 PM今天無意中想起寫驗證碼數(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

? AI ??

Undress AI Tool
??? ???? ??

Undresser.AI Undress
???? ?? ??? ??? ?? AI ?? ?

AI Clothes Remover
???? ?? ???? ??? AI ?????.

Clothoff.io
AI ? ???

Video Face Swap
??? ??? AI ?? ?? ??? ???? ?? ???? ??? ?? ????!

?? ??

??? ??

???++7.3.1
???? ?? ?? ?? ???

SublimeText3 ??? ??
??? ??, ???? ?? ????.

???? 13.0.1 ???
??? PHP ?? ?? ??

???? CS6
??? ? ?? ??

SublimeText3 Mac ??
? ??? ?? ?? ?????(SublimeText3)

??? ??











img ??? ?? ???? ?? ?? ???? ????? ??, ?? ????? ?? ? ?? ?? ??? ?????. ??? ??: 1. ?? ?? ???? ?????? ???? ?? ?? ???? ?????? ??, ??????, img ??? ??? ??? ???? ????, "?? ?????? ??" ?? "?? ????"? ????, ???? ??? ?? ?? ???? ?????? ?????. -up ?? ??, ?? ?? ???? ?????? img ??? ???? ???? ?? ?? ?????? ??? ???? ?????. ?? ?? ?????? ??? ???? ? ? ???? img ??? ?? ?? ???? ???? ? ????. ?.

Golang? ???? ????? ???? ???? undefound:rand.Seed?? ?? ???? ??? ? ????. ? ??? ????? ?? ???? ???? ? ? ?????. Golang??? rand ???? ??? ???? ?? ?? ??? ???? ?? ?????. ? ????? ? ??? ???? ??? ?????. 1. math/rand ???? ????? ?? math/rand ???? ??? ???? ???. ????

img ??? ?? ??: 1. img ?? ??? ?????. 2. img ?? ???? ?????. 3. ?? ??? ?????. 4. ??? ???. img ??? ????? ?? ???? ???? ? ???? ????? ???? ??? ?? ?????.

img? ?? ??? ??? ??? ??? ???? ? ???? ?? ?? ?????. ?? ??? ??? ?? ?? CD? ??? ???? ? ??? ? ??? ???? ".IMG"? ??? ? ?? ??? ???? ?????. img ???? "Ehfa_HeaderTag", "Ehfa_File" ? "Ehfa_Entry"?? 3?? ?? ??? ???? ????.

rand() ??? ? ???? ??? ?? ??? ?????. ?? ?? ??? ?? ??? ???? ????? ???? ?????? ?????. ?, ?? ?? ?? ?? ?? rand() ?? ??? ??? ?? ??? ???? ??? ?? ??? ?????. ???? ? ??? ???? ??? ??????

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

U ???? ?? ???? ?? ?? ? ?????. ?? ??? ? ?? ??? ??? ????. ?? ?? U ???? ??? ??? ? ????? USB ??? ????? ?? ? ????? ??? ?? ???? ??? ???? 4?? USB ??? ????? ???? ??? ? ?? ??? ???? ???? ??? ? ?????! USB ??? ????? ?? ? ????? ??? ?? ???? ??? ???? 4?? ????? ?? ???? ?? ? ? ?????. ????! USB ??? ????? ?? ? ????? ??? ?? ???? ??? ???? 4?? ?? ???? ?? ??????? ?? ?? ?? ????? ?? ?????! USB ??? ????? ?? ? ????? USB ??? ?? ??? ?? ??, ????, ??? ??? ??? ????, ??? ?? ???? ??? ???? 4??! USB ??? ????? ?? ? ????? ??? ?? ???? ??? ???? 4?? ??? ?? ???? ?????!

jquery?? img src ??? ???? ??: 1. attr() ??? ???? "$("img").attr("src","The address of the image file")" ??? ?????. prop() ???, ?? " $("img").prop("src","??? ??? ??")".
