yvcbudd
(yvcbudd)
中级会员
 
中级会员
UID 4670
精华
0
积分 255
帖子 245
金钱 255 喜悦币
威望 0
人脉 0
阅读权限 30
注册 2000-11-7
状态 离线
|
[广告]: Enom域名自助付费 自助注册 自助PUSH 主流域名COM等一律57.99元年
PHP图片验证码问题
PHP做图片验证,现在的问题是图片上的数字不能显示出来,不知道是什么原因,请各位指教!
附:源代码
<?php
session_start();
Header("Content-type: image/PNG");
$im = imagecreate(55,20);
$black = ImageColorAllocate($im, 0,0,0);
$white = ImageColorAllocate($im, 255,255,255);
$gray = ImageColorAllocate($im, 200,200,200);
imagefill($im,0,0,$gray);
//将整数验证码绘入图片
if(session_is_registered("AUTH_STRING"))
imagestring($im, 5, 5, 3, $AUTH_STRING, $black);
else
imagestring($im, 5, 5, 3,"验证码错误", $black);
//加入干扰象素
for($i=0;$i<200;$i++)
{
$randcolor = ImageColorallocate($im,rand(0,255),rand(0,255),rand(0,255));
imagesetpixel($im, rand()%70 , rand()%30 , $randcolor);
}
ImagePNG($im);
ImageDestroy($im);
?>
|
|