您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息

用动态网页技术PHP生成验证码图片的源代码_PHP教程

2025/9/29 1:38:59发布27次查看
文件a.php
//checknum.php
session_start();
function random($len)
{
$srcstr=abcdefghijklmnopqrstuvwxyz0123456789;
mt_srand();
$strs=;
for($i=0;$i$strs.=$srcstr[mt_rand(0,35)];
}
return strtoupper($strs);
}
$str=random(4); //随机生成的字符串
$width = 50; //验证码图片的宽度
$height = 25; //验证码图片的高度
@header(content-type:image/png);
$_session[code] = $str;
//echo $str;
$im=imagecreate($width,$height);
//背景色
$back=imagecolorallocate($im,0xff,0xff,0xff);
//模糊点颜色
$pix=imagecolorallocate($im,187,230,247);
//字体色
$font=imagecolorallocate($im,41,163,238);
//绘模糊作用的点
mt_srand();
for($i=0;$i{
imagesetpixel($im,mt_rand(0,$width),mt_rand(0,$height),$pix);
}
imagestring($im, 5, 7, 5,$str, $font);
imagerectangle($im,0,0,$width-1,$height-1,$font);
imagepng($im);
imagedestroy($im);
$_session[code] = $str;
?>
文件b.php
http://www.bkjia.com/phpjc/509193.htmlwww.bkjia.comtruehttp://www.bkjia.com/phpjc/509193.htmltecharticle文件a.php ? //checknum.php session_start(); function random($len) { $srcstr=abcdefghijklmnopqrstuvwxyz0123456789; mt_srand(); $strs=; for($i=0;$i$len;$i++){ $strs.=$srcstr[mt_ran...
该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录 Product