PHP實現簡單實用的驗證碼類

2022-10-06 10:12:11 字數 1101 閱讀 5420

<?php /**

* @version 1.0

* @author boltedsscpgsqq snail

* @date 2011-10-15

* @php驗證碼類

* 使用方法:

* $image=new captcha();

* $image->config('寬度','高度','字元個數','驗證碼session索引');

* $image->create();//這樣就會向瀏覽器輸出一張

* //所有引數都可以省略,

* 預設是:寬80 高20 字元數4 驗證碼session索引captcha_code

* 第四個引數即把驗證碼存到$_session['captcha_code']

* 最簡單使用示例:

* $image=new captcha();

* $image->create();//這樣就會向瀏覽器輸出一張

*/class captcha

/** 引數:(寬度,高度,字元個數)

*/function config($width='80',$height='20',$codenum='4',$session_flag='captcha_code')

function create()

/* * @brief 輸出頭

*/private function outfileheader()

/** * 產生驗證碼

*/private function createcode()

/** * 產生驗證碼

*/private function createimage()

/** * 設定的干擾畫素

*/private function setdisturbcolor()

}/**

* * 在驗證碼上逐個畫上驗證碼

* */

private function writecheckcodetoimage()

}function __destruct()

}?>

本文標題: php實現簡單實用的驗證碼類

本文位址: /wangluo/php/128846.html

PHP實現簡單的驗證碼

我寫了兩種驗證碼 數字 字母驗證碼和漢字驗證碼。首先是html的表單 if isset post sub else 數字驗證碼authcode 1.php session start yzm 驗證碼 image imagecreatetruecolor 100,30 bgcolor imagecol...

Php 生成驗證碼 實用

php生成驗證碼案例如下 php 驗證碼 session 判斷session是否開啟 if isset session width 90 布畫寬度 height 35 布畫高度 length 5 驗證碼長度 code getcode length 獲取隨機字串 session verfycode c...

PHP驗證碼類

php驗證碼類 如果不適用指定的字型,那麼就用imagestring 函式,如果需要遇到指定的字型,就要用到imagettftext 函式。字型的位置在c盤下windows fonts.verificationcode.class.php class verificationcode 生成驗證碼 p...