php生成随机验证码。该如何处理

WBOY
Release: 2016-06-13 13:17:14
Original
758 people have browsed it

php生成随机验证码。
for($i=0;$i
  $rand.=dechex(rand(1,15));

}
//设置图像大小
$im=imagecreatetruecolor(100,30);
//设置颜色
$bg=imagecolorallocate($im,0,0,0);
$te=imagecolorallocate($im,255,255,255);
//把字符串写在图像上面
imagestring($im,rand(3,6),rand(3,70),rand(0,16),$rand,$te);
//输出图像
header("Content-type: image/jpeg");
imagejpeg($im);


?>

为何图片显示一个红叉。。
gd库已经打开

------解决方案--------------------

探讨

如何我吧$_SESSION[check]=$rand;注释掉就有用,为什么会这样啊
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!