php驗證碼的製作

2021-07-26 03:59:46 字數 536 閱讀 8115

**登入註冊時需要驗證碼,有點干擾和線干擾。效果如圖所示,每次重新整理所顯示文字及干擾點,干擾位置隨機改變

<?php 

session_start();

$image=imagecreatetruecolor(100, 30);//建立100*30的

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

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

$captch_code='';

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

$_session['code']=$captch_code;

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

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

header('content-type:image/png');

imagepng($image);

imagedestroy($image);

?>

php 驗證碼製作

直接上 function buildrandomstring type 1,length 4 else if type 2 else if type 3 if length strlen chars 隨意打亂字串 chars str shuffle chars return substr chars...

php製作驗證碼

session start 型別 type gif 的尺寸 width 40 height 16 header content type image type srand double microtime 1000000 生成字元的個數 randval randstr 4,if type gif f...

php製作驗證碼

用php製作乙個一串驗證碼很簡單,主要需要用到一下函式,到手冊上查詢下就知道了,需要注意imagettftext,需要乙個字型檔案,我在win7控制面板字型裡拷貝出來的.這個函式比imagestring 好一點是因為,可以改變字型,和字型大小,imagestring只提供內建的字型大小1,2,3,4...