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

PHP图片验证码制作(中)_PHP教程

2026/1/3 8:44:55发布21次查看
随机生成数字,字母的代码:
给图片画出干扰线代码:
for($i=0;$i{
$cg=imagecolorallocate($im,rand(0,255),rand(0,255),rand(0,255));//产生随机的颜色
imageline($im,rand(10,40),0,rand(10,40),20,$cg);
}
给图片画出干扰点的代码:
for($i=0;$i{
imagesetpixel($im,rand(0,40),rand(0,20),$cg);
}
把文字写入图片代码:
$str=array('我','我','亲','亲');//存储显示的汉字
for($i=0;$i{
     $sss.=$str[rand(0,3)];//随机显示汉字
}
//$str=iconv(gb2312,utf-8,$str); //汉字编码转化,我的好像不需要
imagettftext($im,10,0,rand(5,60),rand(5,60),$te,simhei.ttf,$sss);//
0:字体的倾斜度,“simhei.ttf”:字体样式,一般放在根目录下;
摘自 ms.元
http://www.bkjia.com/phpjc/478237.htmlwww.bkjia.comtruehttp://www.bkjia.com/phpjc/478237.htmltecharticle随机生成数字,字母的代码: ?php //che.php session_start(); for($i=0;$i4;$i++) { $rand.=dechex(rand(1,15)); } $_session[check_num]=$rand; $image=imagecreatetruecolor(50...
该用户其它信息

VIP推荐

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