奶头挺立呻吟高潮av全片,成人试看120秒体验区,性欧美极品v,A片高潮抽搐揉捏奶头视频

php語言

php實現驗證碼制作

時間:2025-03-22 02:13:30 php語言 我要投稿
  • 相關推薦

php實現驗證碼制作

  驗證碼分為:數字驗證碼,字母驗證碼,數字加字母驗證碼,圖片驗證碼,漢子驗證碼,視頻驗證碼等!由于原理相同,且根據平時的使用范圍來看,今天在這里只講數字驗證碼,字母驗證碼,數字加字母驗證碼。下面是由百分網小編為大家整理的php實現驗證碼制作,喜歡的可以收藏一下!了解更多詳情資訊,請關注應屆畢業生考試網!

  首先,看一張圖了解驗證碼生成的過程。

  (1)生成驗證碼底圖

  (2)驗證碼內容

  (3)生成驗證碼

  (4)對比校驗

  驗證碼實現的核心技術分析

  (a)底圖的實現,并添加干擾元素

  (b)生成驗證內容

  (c)驗證內容保存在服務端

  (d)驗證內容的校驗

  下面看代碼實現的過程

  <?php

  /*

  這段代碼 實現了產生 隨機數字,隨機數字+字母驗證碼

  */

  session_start();

  $image = imagecreatetruecolor(100, 30);

  //imagecreatetruecolor() 返回一個圖像標識符,代表了一幅大小為 x_size 和 y_size 的黑色圖像。

  $bgcolor = imagecolorallocate($image, 255, 255, 255);

  // imagecolorallocate — 為一幅圖像分配顏色

  imagefill($image,0,0,$bgcolor);

  /*   生成字母驗證碼

  for($i=0;$i<4;$i++)

  {

  $fontsize = 6;

  // $fontcolor = imagecolorallocate($image, 0, 0, 0);

  $fontcolor = imagecolorallocate($image, rand(0,120), rand(0,120), rand(0,120));

  $fontcontent =rand(0,9);

  $x = ($i*100/4) + rand(5,10);

  $y = rand(5,10);

  // imagestring — 水平地畫一行字符串

  imagestring($image, $fontsize, $x, $y, $fontcontent, $fontcolor);

  }

  */

  // 生成字母加數字的隨機驗證碼

  $captcha_code = "";

  for($i=0;$i<4;++$i)

  {

  $fontsize = 6;

  $fontcolor = imagecolorallocate($image, rand(0,120), rand(0,120), rand(0,120));

  $data = "abcdefghijklmnopqrstuvwxtz123456789";

  $fontcontent = substr($data,rand(0,strlen($data)),1);

  $captcha_code.=$fontcontent;

  $x = ($i*100/4) + rand(5,10);

  $y = rand(5,10);

  imagestring($image, $fontsize, $x, $y, $fontcontent, $fontcolor);

  }

  $_SESSION['authcode']=$captcha_code;

  //  給驗證碼添加點干擾項

  for($i=0;$i<200;$i++)

  {

  $pointcolor = imagecolorallocate($image, rand(50,200), rand(50,200), rand(50,200));

  imagesetpixel($image, rand(1,99), rand(1,29), $pointcolor);

  // bool imagesetpixel ( resource $image , int $x , int $y , int $color );

  // imagesetpixel() 在 image 圖像中用 color 顏色在 x,y 坐標(圖像左上角為 0,0)上畫一個點。

  }

  // 增加線的干擾

  for($i=0;$i<3;++$i)

  {

  $linecolor = imagecolorallocate($image, rand(80,220), rand(80,220), rand(80,220));

  imageline($image, rand(1,99), rand(1,29), rand(1,99), rand(1,29), $linecolor);

  }

  header("Content-Type: image/png");

  imagepng($image);

  imagedestroy($image);

  ?>

【php實現驗證碼制作】相關文章:

php如何實現驗證碼06-13

PHP實現簡易blog的制作01-25

如何實現php登陸表單提交CSRF及驗證碼05-20

php驗證碼代碼怎么寫04-02

實現PHP實現限制IP訪問02-23

一個漂亮的php驗證碼類01-10

用php生成帶有雪花背景的驗證碼01-08

仿照TP框架自帶的PHP驗證碼類12-29

php生成動態圖片驗證碼代碼07-23

主站蜘蛛池模板: 碌曲县| 深圳市| 鄯善县| 阜康市| 广饶县| 体育| 恩施市| 理塘县| 阿克陶县| 射阳县| 衡东县| 安平县| 松江区| 红安县| 名山县| 嵩明县| 房产| 东乡族自治县| 苍梧县| 涟源市| 香港| 石楼县| 阜宁县| 家居| 汉沽区| 大同县| 定襄县| 松桃| 丰原市| 庆城县| 荔波县| 来凤县| 东乌珠穆沁旗| 杨浦区| 布尔津县| 大足县| 黎川县| 平遥县| 高要市| 扬州市| 蓬溪县|