中文字幕在线观看,亚洲а∨天堂久久精品9966,亚洲成a人片在线观看你懂的,亚洲av成人片无码网站,亚洲国产精品无码久久久五月天

php生成圖形驗證碼

2018-07-20    來源:open-open

容器云強勢上線!快速搭建集群,上萬Linux鏡像隨意使用
<?php
 
session_start();
// main
$vcodes = '';
//generate Number 4
srand((double) microtime() * 1000000);
for ($i = 0; $i < 4; $i++) {
    $vcodes .= rand(1, 9);
}
$_SESSION['eifr_checkvcode'] = $vcodes;
if (function_exists('imagecreate')) {
    //generate picture validation code
    Header("Content-type: image/PNG");
    $img = imagecreate(44, 18);
    $bg  = ImageColorAllocate($img, 245, 245, 245);
    imagefill($img, 0, 0, $bg); //background
     
    //generate Number 4
    for ($i = 0; $i < 4; $i++) {
        $font = ImageColorAllocate($img, rand(100, 255), rand(0, 100), rand(100, 255));
        $vnum = substr($vcodes, $i, 1);
        imagestring($img, 5, 2 + $i * 10, 1, $vnum, $font);
    }
    //add interference
    for ($i = 0; $i < 100; $i++) {
        $randcolor = ImageColorallocate($img, rand(0, 255), rand(0, 255), rand(0, 255));
        imagesetpixel($img, rand() % 70, rand() % 30, $randcolor);
    }
    ImagePNG($img);
    ImageDestroy($img);
}
?>

標簽:

版權申明:本站文章部分自網(wǎng)絡,如有侵權,請聯(lián)系:west999com@outlook.com
特別注意:本站所有轉(zhuǎn)載文章言論不代表本站觀點!
本站所提供的圖片等素材,版權歸原作者所有,如需使用,請與原作者聯(lián)系。

上一篇:Android 檢查網(wǎng)絡連接狀態(tài)的代碼實現(xiàn)

下一篇:Asp.Net 加密解密