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

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定

封裝成類!

<?php
/**
?*?Created?by?PhpStorm.
?*?User:?Admin
?*?Date:?2019/4/12
?*?Time:?11:50
?*/

class?CaptchaC
{
????private?$image;

????public?function?__construct()
????{
????????//創(chuàng)建一張底圖
????????$this->image?=?imagecreatetruecolor(200,?50);
????????//為一幅圖像分配顏色
????????$bgcolor?=?imagecolorallocate($this->image,?255,?255,?255);
????????//區(qū)域填充?imagefill()??在?image?圖像的坐標(biāo)?x,y(圖像左上角為?0,?0)處用?color
????????//顏色執(zhí)行區(qū)域填充(即與?x,?y?點(diǎn)顏色相同且相鄰的點(diǎn)都會(huì)被填充)。
????????imagefill($this->image,?0,?0,?$bgcolor);
//????????$this->alpNum();
????????$this->cha();
????????$this->interfere();
????}

????public?function?__destruct()
????{
????????imagedestroy($this->image);
????}

????public?function?outPut()
????{
????????header('Content-Type:?image/png');//加這一句
????????imagepng($this->image);
????}

????//生成漢字驗(yàn)證碼
????public?function?cha()
????{
????????$fontfile?=?"MSYH.TTF";//字體樣式
????????$fonts?=?$this->font();//驗(yàn)證碼字體庫--
????????$strdb?=?str_split($fonts,?3);
????????$captch_code?=?'';
????????for?($i?=?0;?$i?<?4;?$i++)?{
????????????//為一幅圖像分配顏色--隨機(jī)生成驗(yàn)證碼的顏色
????????????$fontcolor?=?imagecolorallocate($this->image,?rand(0,?120),?rand(0,?120),?rand(0,?120));
????????????$text?=?$strdb[mt_rand(0,?count($strdb)?-?1)];
????????????$captch_code?.=?$text;
????????????//為圖像插入字符
????????????imagettftext($this->image,?mt_rand(20,?24),?mt_rand(-60,?60),?(40?*?$i?+?20),?mt_rand(30,?35),?$fontcolor,?$fontfile,?$text);
????????}
????}

????//生成字母數(shù)字驗(yàn)證碼
????public?function?alpNum()
????{
????????session_start();
????????$content?=?"ABCDEFGHIJKLMNPQRSTUVWXYabcdefghigkmnpqrstuvwxy3456789";
????????$captcha?=?'';
????????for?($i?=?0;?$i?<?4;?$i++)?{
????????????$fontsize?=?6;
????????????//為一幅圖像分配顏色--隨機(jī)生成驗(yàn)證碼的顏色
????????????$fontcolor?=?imagecolorallocate($this->image,?rand(0,?120),?rand(0,?120),?rand(0,?120));
????????????//substr根據(jù)下標(biāo)截取字符串,strlen獲取字符串長(zhǎng)度
????????????$fontcontent?=?substr($content,?mt_rand(0,?strlen($content)?-?1),?1);
????????????$captcha?.=?$fontcontent;
????????????$x?=?($i?*?200?/?4)?+?rand(30,?40);
????????????$y?=?rand(20,?30);
????????????//?水平地畫一行字符串?參數(shù):要畫的圖像,字體大小,圖像的坐標(biāo)x,y,字體顏色
????????????imagestring($this->image,?$fontsize,?$x,?$y,?$fontcontent,?$fontcolor);
????????}
????????$_SESSION['captcha']?=?$captcha;
????}

????//生成干擾元素
????public?function?interfere()
????{
????????for?($i?=?0;?$i?<?300;?$i++)?{
????????????//為一幅圖像分配顏色--隨機(jī)生成點(diǎn)的顏色
????????????$pointcolor?=?imagecolorallocate($this->image,?rand(50,?200),?rand(50,?200),?rand(50,?200));
????????????//—?畫一個(gè)單一像素
????????????imagesetpixel($this->image,?rand(1,?199),?rand(1,?59),?$pointcolor);
????????}
????????for?($i?=?0;?$i?<?3;?$i++)?{
????????????//為一幅圖像分配顏色--隨機(jī)生成線的顏色
????????????$linecolor?=?imagecolorallocate($this->image,?rand(80,?220),?rand(80,?220),?rand(80,?220));
????????????//—?畫一條線段?需要倆個(gè)點(diǎn)確定一條線
????????????imageline($this->image,?rand(1,?199),?rand(1,?59),?rand(1,?199),?rand(1,?59),?$linecolor);
????????}
????}

????//驗(yàn)證碼字體庫--
????private?function?font()
????{
????????return?"關(guān)雎鳩在河洲窈窕淑君子好逑參差荇菜左流窈窕淑女寤寐求求不得寤寐思服悠哉悠哉輾轉(zhuǎn)反側(cè)參差荇菜右采之窈窕淑琴瑟友參差荇菜左右芼窈窕鐘鼓樂蒹葭蒼蒼白露為霜所謂伊人在水一方溯洄從之道阻且長(zhǎng)溯游從之宛在水中央蒹葭凄凄白露未晞所謂伊人在水之湄溯洄從之道阻且躋溯游從之宛在水中坻蒹葭采采白露未已所謂伊人在水之涘溯洄從之道阻且右溯游從之宛在水中沚";
????}
}


正在回答

舉報(bào)

0/150
提交
取消

封裝成類!

我要回答 關(guān)注問題
微信客服

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

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)