求php图片验证码 点击可刷新那种 看下GD,生成验证码放到SESSION。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 <?phpsession_start(); header("Content-type: image/PNG"); srand((double)microtime()*1000000); $checknum=rand(999,9999); $im = imagecreate(60,22); $black = ImageColorAllocate($im, 0,0,0); $white = ImageColorAllocate($im, 255,255,255); $gray = ImageColorAllocate($im, 200,200,200); $red=imageColorAllocate($im,255,0,0); imagefill($im,0,0,$gray); imagestring($im, 10, 10, 5, $checknum, $black); for($i=0;$i<300;$i++) { $randcolor=ImageColorAllocate($im,rand(0,255),rand(0,255),rand(0,255)); imagesetpixel($im, rand()%70 , rand()%30 , $randcolor); } for($i=0;$i<6;$i++) { imageline($im,rand()%70,rand%30,rand()%70+2,rand()%70-1,$randcolor); } $_SESSION['checknum']=$checknum; ImagePNG($im); ImageDestroy($im);?>从前写过的一个,没加载字体,可以自己修改一些,大概思路就是这样了 哦,还要点击可刷新啊,你可以把上面的代码放到某个层里调用如:<div class="login_check"><img src="num_gen.php" width="60" height="22" /></div>然后给层一个js的onclick事件,事件中重新载入图片就可以了。 php 求一个字符替换 何写才能将session写对啊?? 求一个好的开源编辑器!! 重启APM提示Error 一般性错误 2 :系统找不到指定的文件 php apc 安装 哪位高手推荐一款比较好用的邮件系统,Linux平台的 php页面正常,刷新正常,退回报错 Zend Optimizer 问题 php中怎样获得请求页的url? ' : '的问题 php怎么把unicode转换成gb2312 再次提问php 截取字符串的问题.(再加100分,如果解决两个贴子一起给分。)
session_start();
header("Content-type: image/PNG");
srand((double)microtime()*1000000);
$checknum=rand(999,9999);
$im = imagecreate(60,22);
$black = ImageColorAllocate($im, 0,0,0);
$white = ImageColorAllocate($im, 255,255,255);
$gray = ImageColorAllocate($im, 200,200,200);
$red=imageColorAllocate($im,255,0,0);
imagefill($im,0,0,$gray);
imagestring($im, 10, 10, 5, $checknum, $black);
for($i=0;$i<300;$i++)
{
$randcolor=ImageColorAllocate($im,rand(0,255),rand(0,255),rand(0,255));
imagesetpixel($im, rand()%70 , rand()%30 , $randcolor);
}
for($i=0;$i<6;$i++)
{
imageline($im,rand()%70,rand%30,rand()%70+2,rand()%70-1,$randcolor);
}
$_SESSION['checknum']=$checknum;
ImagePNG($im);
ImageDestroy($im);
?>
从前写过的一个,没加载字体,可以自己修改一些,大概思路就是这样了