生手求
程序员文章站
2022-06-02 14:39:30
...
新手求
/**
* TestGuest Version1.0
* ================================================
* Copy 2010-2012 yc60
* Web: http://www.yc60.com
* ================================================
* Author: Lee
* Date: 2010-8-13
*/
session_start();
$_rnd_code = 4;
for ($i=0;$i $_nmsg .= dechex(mt_rand(0,15));
}
$_SESSION['code'] = $_nmsg;
$_width = 75;
$_height = 25;
$_img = imagecreatetruecolor($_width,$_height);
$_white = imagecolorallocate($_img,255,255,255);
imagefill($_img,0,0,$_white);
$_flag = false;
if ($_flag) {
$_black = imagecolorallocate($_img,0,0,0);
imagerectangle($_img,0,0,$_width-1,$_height-1,$_black);
}
for ($i=0;$i $_rnd_color = imagecolorallocate($_img,mt_rand(0,255),mt_rand(0,255),mt_rand(0,255));
imageline($_img,mt_rand(0,$_width),mt_rand(0,$_height),mt_rand(0,$_width),mt_rand(0,$_height),$_rnd_color);
}
for ($i=0;$i $_rnd_color = imagecolorallocate($_img,mt_rand(200,255),mt_rand(200,255),mt_rand(200,255));
imagestring($_img,1,mt_rand(1,$_width),mt_rand(1,$_height),'*',$_rnd_color);
}
for ($i=0;$i
$_rnd_color = imagecolorallocate($_img,mt_rand(0,100),mt_rand(0,150),mt_rand(0,200));
imagestring($_img,5,$i*$_width/$_rnd_code+mt_rand(1,10),mt_rand(1,$_height/2),$_SESSION['code'][$i],$_rnd_color);
}
header('Content-Type: image/png');
imagepng($_img);
imagedestroy($_img);
?>
我这显示不了验证码,哪里错了新手求指教
/**
* TestGuest Version1.0
* ================================================
* Copy 2010-2012 yc60
* Web: http://www.yc60.com
* ================================================
* Author: Lee
* Date: 2010-8-13
*/
session_start();
$_rnd_code = 4;
for ($i=0;$i $_nmsg .= dechex(mt_rand(0,15));
}
$_SESSION['code'] = $_nmsg;
$_width = 75;
$_height = 25;
$_img = imagecreatetruecolor($_width,$_height);
$_white = imagecolorallocate($_img,255,255,255);
imagefill($_img,0,0,$_white);
$_flag = false;
if ($_flag) {
$_black = imagecolorallocate($_img,0,0,0);
imagerectangle($_img,0,0,$_width-1,$_height-1,$_black);
}
for ($i=0;$i $_rnd_color = imagecolorallocate($_img,mt_rand(0,255),mt_rand(0,255),mt_rand(0,255));
imageline($_img,mt_rand(0,$_width),mt_rand(0,$_height),mt_rand(0,$_width),mt_rand(0,$_height),$_rnd_color);
}
for ($i=0;$i $_rnd_color = imagecolorallocate($_img,mt_rand(200,255),mt_rand(200,255),mt_rand(200,255));
imagestring($_img,1,mt_rand(1,$_width),mt_rand(1,$_height),'*',$_rnd_color);
}
for ($i=0;$i
imagestring($_img,5,$i*$_width/$_rnd_code+mt_rand(1,10),mt_rand(1,$_height/2),$_SESSION['code'][$i],$_rnd_color);
}
header('Content-Type: image/png');
imagepng($_img);
imagedestroy($_img);
?>
我这显示不了验证码,哪里错了新手求指教
专题推荐
-
独孤九贱-php全栈开发教程
全栈 170W+
主讲:Peter-Zhu 轻松幽默、简短易学,非常适合PHP学习入门
-
玉女心经-web前端开发教程
入门 80W+
主讲:灭绝师太 由浅入深、明快简洁,非常适合前端学习入门
-
天龙八部-实战开发教程
实战 120W+
主讲:西门大官人 思路清晰、严谨规范,适合有一定web编程基础学习
- 最新文章
- 热门排行
网友评论
文明上网理性发言,请遵守 新闻评论服务协议
我要评论