?? getcode.php
字號:
<?
$authnum = '';
$str = '0123456789';
$l = strlen($str);
for($i=1;$i<=4;$i++)
{
$num=rand(0,$l-1);
$authnum.= $str[$num];
}
setcookie ("authnum",$authnum);
//生成驗證碼圖片
Header("Content-type: image/PNG");
srand((double)microtime()*1000000);
while(($Img=rand()%10000)<1000);
$im = imagecreate(40,18);
$green= ImageColorAllocate($im, 0,127,0);
$white = ImageColorAllocate($im, 255,255,100);
$bgcolor = ImageColorAllocate($im, 255,255,255);
imagefill($im,30,15,$bgcolor);
//將四位整數驗證碼繪入圖片
imagestring($im, 5, 2, 2, $authnum, $black);
//for($i=0;$i<50;$i++) //加入干擾象素
//{
//imagesetpixel($im, rand()%70 , rand()%30 , $white);
//}
ImagePNG($im);
ImageDestroy($im);
?>
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -