内射老阿姨1区2区3区4区_久久精品人人做人人爽电影蜜月_久久国产精品亚洲77777_99精品又大又爽又粗少妇毛片

PHP碎碼——ci的驗(yàn)證碼-創(chuàng)新互聯(lián)

自己寫驗(yàn)證碼的時(shí)候在文字定位上拿捏不準(zhǔn)

10年積累的網(wǎng)站設(shè)計(jì)、成都網(wǎng)站制作經(jīng)驗(yàn),可以快速應(yīng)對(duì)客戶對(duì)網(wǎng)站的新想法和需求。提供各種問(wèn)題對(duì)應(yīng)的解決方案。讓選擇我們的客戶得到更好、更有力的網(wǎng)絡(luò)服務(wù)。我雖然不認(rèn)識(shí)你,你也不認(rèn)識(shí)我。但先做網(wǎng)站設(shè)計(jì)后付款的網(wǎng)站建設(shè)流程,更有復(fù)興免費(fèi)網(wǎng)站建設(shè)讓你可以放心的選擇與我們合作。

于是把ci驗(yàn)證碼主要部分扣了出來(lái),看看,一般般,干擾線是亮點(diǎn)

代碼去除了很多判斷,簡(jiǎn)化了很多,顯示效果一樣

<?php $defaults = array(     'word'        => '',     'img_path'    => './',     'img_url'    => '',     'img_width'    => '150',     'img_height'    => '30',     'font_path'    => './instance/font/Elephant.ttf',     'expiration'    => 7200,     'word_length'    => 4,     'font_size'    => 16,     'img_id'    => '',     'pool'        => '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ',     'colors'    => array(         'background'    => array(255,255,255),         'border'    => array(153,102,102),         'text'        => array(204,153,153),         'grid'        => array(255,182,182)     ) ); // 將變量從數(shù)組中取出 foreach ($defaults as $key => $val){         $$key = $val; } // 生成隨機(jī)碼 $word = ''; $pool_length = strlen($pool); $rand_max = $pool_length - 1; for ($i = 0; $i < $word_length; $i++){     $word .= $pool[mt_rand(0, $rand_max)]; } // 驗(yàn)證碼長(zhǎng)度 $length    = strlen($word); //角度 $angle    = ($length >= 6) ? mt_rand(-($length-6), ($length-6)) : 0; $x_axis    = mt_rand(6, (360/$length)-16); $y_axis = ($angle >= 0) ? mt_rand($img_height, $img_width) : mt_rand(6, $img_height); // 創(chuàng)建圖片句柄 $im = p_w_picpathcreatetruecolor($img_width, $img_height); // 創(chuàng)建顏色 foreach ($colors as $key => $values) {     $colors[$key] = p_w_picpathcolorallocate($im, $colors[$key][0], $colors[$key][1], $colors[$key][2]); } // 畫(huà)了個(gè)和圖片等大的矩形,就是背景 ImageFilledRectangle($im, 0, 0, $img_width, $img_height, $colors['background']); // -----------------干擾線-------------------------- $theta        = 1; $thetac        = 7; $radius        = 16; $circles    = 20; $points        = 32; for ($i = 0, $cp = ($circles * $points) - 1; $i < $cp; $i++) {     $theta += $thetac;     $rad = $radius * ($i / $points);     $x = ($rad * cos($theta)) + $x_axis;     $y = ($rad * sin($theta)) + $y_axis;     $theta += $thetac;     $rad1 = $radius * (($i + 1) / $points);     $x1 = ($rad1 * cos($theta)) + $x_axis;     $y1 = ($rad1 * sin($theta)) + $y_axis;     p_w_picpathline($im, $x, $y, $x1, $y1, $colors['grid']);     $theta -= $thetac; } // -------------------------------------------------------------- // 無(wú)字體 // ($font_size > 5) && $font_size = 5; // $x = mt_rand(0, $img_width / ($length / 3)); // $y = 0; // for ($i = 0; $i < $length; $i++){ //     $y = mt_rand(0 , $img_height / 2); //     p_w_picpathstring($im, $font_size, $x, $y, $word[$i], $colors['text']); //     $x += ($font_size * 2); // } // 有字體 // x 第一個(gè)字符隨機(jī)在圖片的前面一小段,后面依次加一個(gè)字符大小的寬度 // y 圖片的1/2到距離底部3px之間隨機(jī) ($font_size > 30) && $font_size = 30; $x = mt_rand(0, $img_width / ($length / 1.5)); $y = $font_size + 2; for ($i = 0; $i < $length; $i++){     $y = mt_rand($img_height / 2, $img_height - 3);     p_w_picpathttftext($im, $font_size, $angle, $x, $y, $colors['text'], $font_path, $word[$i]);     $x += $font_size; } //畫(huà)矩形框 p_w_picpathrectangle($im, 0, 0, $img_width - 1, $img_height - 1, $colors['border']); // 刪除以前保存的圖片 $now = microtime(TRUE); $current_dir = opendir($img_path); while ($filename = readdir($current_dir)){     if (in_array(substr($filename, -4), array('.jpg', '.png'))&& (str_replace(array('.jpg', '.png'), '', $filename) + 0.1) < $now){         @unlink($img_path.$filename);     } } @closedir($current_dir); // 拼接文件路徑并保存 $img_url = rtrim($img_url, '/').'/'; $img_filename = $now.'.jpg'; p_w_picpathjpeg($im, $img_path.$img_filename); $img = '<img  src="'.$img_url.$img_filename.'"  alt=" " />'; // ImageDestroy($im); // return array('word' => $word, 'time' => $now, 'p_w_picpath' => $img, 'filename' => $img_filename); // echo $img; //通知瀏覽器是png格式 header('Content-type:p_w_picpath/jpg'); //以png格式輸出 p_w_picpathjpeg($im); //銷毀內(nèi)存中的圖片資源 p_w_picpathdestroy($im);

另外有需要云服務(wù)器可以了解下創(chuàng)新互聯(lián)cdcxhl.cn,海內(nèi)外云服務(wù)器15元起步,三天無(wú)理由+7*72小時(shí)售后在線,公司持有idc許可證,提供“云服務(wù)器、裸金屬服務(wù)器、高防服務(wù)器、香港服務(wù)器、美國(guó)服務(wù)器、虛擬主機(jī)、免備案服務(wù)器”等云主機(jī)租用服務(wù)以及企業(yè)上云的綜合解決方案,具有“安全穩(wěn)定、簡(jiǎn)單易用、服務(wù)可用性高、性價(jià)比高”等特點(diǎn)與優(yōu)勢(shì),專為企業(yè)上云打造定制,能夠滿足用戶豐富、多元化的應(yīng)用場(chǎng)景需求。

本文題目:PHP碎碼——ci的驗(yàn)證碼-創(chuàng)新互聯(lián)
本文URL:http://www.rwnh.cn/article8/essop.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供網(wǎng)站排名、動(dòng)態(tài)網(wǎng)站、Google、電子商務(wù)、虛擬主機(jī)、網(wǎng)站內(nèi)鏈

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)

外貿(mào)網(wǎng)站建設(shè)
宁津县| 都昌县| 汾西县| 京山县| 轮台县| 冷水江市| 藁城市| 丘北县| 香格里拉县| 苏尼特左旗| 奉节县| 深水埗区| 保康县| 略阳县| 中宁县| 正阳县| 分宜县| 蒙城县| 盐池县| 齐河县| 凉城县| 伊金霍洛旗| 泰州市| 翁牛特旗| 措美县| 大连市| 深圳市| 水富县| 闻喜县| 凤冈县| 天峻县| 禹州市| 杭锦旗| 高州市| 高阳县| 招远市| 新泰市| 镇康县| 龙门县| 灵寿县| 临安市|