第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機立即綁定

完善驗證碼

<?php
$img?=?imagecreatetruecolor(100,?40);
$black?=?imagecolorallocate($img,?0x00,?0x00,?0x00);
$green?=?imagecolorallocate($img,?0x00,?0xFF,?0x00);
$white?=?imagecolorallocate($img,?0xFF,?0xFF,?0xFF);
imagefill($img,0,0,$white);
//生成隨機的驗證碼
$code?=?'';
$x?=?10?+?rand(0,20);
$y?=?13?+?rand(-15,?15);
for($i?=?0;?$i?<?4;?$i++)?{
????$tmp?=?rand(0,?9);
????$randcolor?=?imagecolorallocate($img,?rand(0,180),?rand(0,180),?rand(0,180));//隨機色
????imagestring($img,?5,?$x,?$y,?$tmp,?$randcolor);
????$code?.=?$tmp;
????$x?+=?rand(12,25);
????$y?=?13?+?rand(-15,?15);
????
????$lx1?=?rand(0,?100);
????$ly1?=?rand(0,?40);
????$lx2?=?rand(0,?100);
????$ly2?=?rand(0,?40);
????$randcolor?=?imagecolorallocate($img,?rand(0,255),?rand(0,255),?rand(0,255));
????imageline($img,$lx1,$ly1,$lx2,$ly2,$randcolor);
}

//加入噪點干擾
for($i=0;$i<50;$i++)?{
??imagesetpixel($img,?rand(0,?100)?,?rand(0,?40)?,?$black);?
??imagesetpixel($img,?rand(0,?100)?,?rand(0,?40)?,?$green);
}
//輸出驗證碼
header("content-type:?image/png");
imagepng($img);
imagedestroy($img);


正在回答

1 回答

<?php
$img = imagecreatetruecolor(100, 40);
$black = imagecolorallocate($img, 0x00, 0x00, 0x00);
$green = imagecolorallocate($img, 0x00, 0xFF, 0x00);
$white = imagecolorallocate($img, 0xFF, 0xFF, 0xFF);
imagefill($img,0,0,$white);
//生成隨機的驗證碼
$code = '';
for($i = 0; $i < 4; $i++) {
??? $code .= rand(0, 9);
}
imagestring($img, 5, 10, 10, $code, $black);
//加入噪點干擾
for($i=0;$i<50;$i++) {
? imagesetpixel($img, rand(0, 100) , rand(0, 100) , $black);
? imagesetpixel($img, rand(0, 100) , rand(0, 100) , $green);
}
//輸出驗證碼
header("content-type: image/png");
imagepng($img);
imagedestroy($img);

0 回復 有任何疑惑可以回復我~

舉報

0/150
提交
取消
PHP進階篇
  • 參與學習       181944    人
  • 解答問題       2668    個

輕松學習PHP中級課程,進行全面了解,用PHP快速開發(fā)網(wǎng)站程序

進入課程

完善驗證碼

我要回答 關注問題
微信客服

購課補貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網(wǎng)微信公眾號