php 生成验证码不显示,大家帮我看看是那里有问题???

gsdfdfdere19800811 2009-09-02 03:06:12
php 生成验证码不显示,大家帮我看看是那里有问题???
GD库是能用的!
<?php 
session_start();
header ("content-type: image/png");
$im=imagecreate(50,18);
$bank=imagecolorallocate($im,255,255,255);
imagefill($im,0,0,$bank);
srand((double)microtime()*1000000);
for($i=0;$i<4;$i++)
{
$font=imagecolorallocate($im,rand(100,255),rand(0,100),rand(100,255));
$num=rand(1,9);
$value.=$num;
imagestring($im,5,2+$i*10,1,$num,$font);
}
for($i=0;$i<100;$i++) {
$randcolor = imagecolorallocate($im,rand(0,255),rand(0,255),rand(0,255));
imagesetpixel($im, rand()%70 , rand()%30 , $randcolor);
}
imagepng($im);
imagedestroy($im);

$_SESSION['VCODE'] = $value;
?>
...全文
111 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
gsdfdfdere19800811 2009-09-04
  • 打赏
  • 举报
回复
$value这个变量未定义?
webstar16 2009-09-04
  • 打赏
  • 举报
回复
gd库加了吗?
餅餅 2009-09-02
  • 打赏
  • 举报
回复
看代码好像没什么问题 估计是图片的路径错了吧
gsdfdfdere19800811 2009-09-02
  • 打赏
  • 举报
回复
找到原因了

21,891

社区成员

发帖
与我相关
我的任务
社区描述
从PHP安装配置,PHP入门,PHP基础到PHP应用
社区管理员
  • 基础编程社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧