这种验证码怎么做出来的 楼上们说的都可以实现...也可以用静态flash不管用什么办法,反正是挺酷的... 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 图形编程数据放到session里了吧google查一下好多资料的 <?php Header("Content-type: image/PNG"); srand((double)microtime()*1000000);session_start();$_SESSION['authnum']="";$im = imagecreate(62,20); $black = ImageColorAllocate($im, 0,0,0); //设置图片$white = ImageColorAllocate($im, 255,255,255); //设置图片$gray = ImageColorAllocate($im, 200,200,200); //设置图片imagefill($im,0,0,$gray); while(($authnum=rand()%100000)<10000);$_SESSION['authnum']=$authnum;imagestring($im, 5, 10, 3, $authnum, $black);for($i=0;$i<200;$i++) { $randcolor = ImageColorallocate($im,rand(0,255),rand(0,255),rand(0,255));imagesetpixel($im, rand()%70 , rand()%30 , $randcolor); } ImagePNG($im); ImageDestroy($im); ?>至于你说的那个图片样式就要自己处理了可以在上面写的设置图片那里处理 这只是一个图象处理问题给你一个简单的测试例:header("Content-type: image/png");$size = 100;$angle = 0;$font = 'c:/windows/fonts/arial.ttf';$text = '5';$ar = imagettfbbox($size, $angle, $font, $text);$width = $ar[2]+2;$height = abs($ar[1]+$ar[7])+2;$im = imagecreatetruecolor($width, $height);$white = imagecolorallocate($im, 255, 255, 255);$black = imagecolorallocate($im, 0, 0, 0);imagefilledrectangle($im, 0, 0, $width, $height, $white);imagettftext($im, $size, 1, 1, imagesy($im)-1, $black, $font, $text);$im1 = imagecreatetruecolor($width, $height);$white = imagecolorallocate($im1, 255, 255, 255);$black = imagecolorallocate($im1, 0, 0, 0);imagefilledrectangle($im1, 0, 0, $width, $height, $white);$k = 3;$xo = -1;$yo = -1;for($y=0; $y<imagesy($im); $y+=$k) { for($x=0; $x<imagesx($im); $x+=$k) { if(imagecolorat($im, $x, $y) == 0) { if($xo < 0) $xo = $x; else imageline($im1, $xo, $y, $x, $y, $black); }else $xo = -1; }}imagepng($im1);imagedestroy($im);imagedestroy($im1); action去一个php页面竟然提示下载? 关于php上传图片保存的问题 [新手请教]PHP写入MySQL数据库的问题 php搜索结果分页问题 计算字符串的长度的问题? 导出excel文件如何换列? SQL多了个排序导致MYSQL意外崩溃?? 请问MYSQL数据库中建立索引,索引的基数是什么意思? php 4.2.3改成php 4.3.10后从mssql数据库读出char字段内容后面的空格不会自动消除?如何设置才能让它默认消除掉 一个高难度的写法,老手也要胆寒一会 有用ethna和smarty的吗? 一个奇怪的现象
数据放到session里了吧
google查一下
好多资料的
Header("Content-type: image/PNG");
srand((double)microtime()*1000000);
session_start();
$_SESSION['authnum']="";
$im = imagecreate(62,20);
$black = ImageColorAllocate($im, 0,0,0); //设置图片
$white = ImageColorAllocate($im, 255,255,255); //设置图片
$gray = ImageColorAllocate($im, 200,200,200); //设置图片
imagefill($im,0,0,$gray);
while(($authnum=rand()%100000)<10000);
$_SESSION['authnum']=$authnum;
imagestring($im, 5, 10, 3, $authnum, $black);
for($i=0;$i<200;$i++)
{
$randcolor = ImageColorallocate($im,rand(0,255),rand(0,255),rand(0,255));
imagesetpixel($im, rand()%70 , rand()%30 , $randcolor);
}
ImagePNG($im);
ImageDestroy($im);
?>
至于你说的那个图片样式就要自己处理了可以在上面写的设置图片那里处理
给你一个简单的测试例:header("Content-type: image/png");
$size = 100;
$angle = 0;
$font = 'c:/windows/fonts/arial.ttf';
$text = '5';
$ar = imagettfbbox($size, $angle, $font, $text);
$width = $ar[2]+2;
$height = abs($ar[1]+$ar[7])+2;$im = imagecreatetruecolor($width, $height);$white = imagecolorallocate($im, 255, 255, 255);
$black = imagecolorallocate($im, 0, 0, 0);
imagefilledrectangle($im, 0, 0, $width, $height, $white);imagettftext($im, $size, 1, 1, imagesy($im)-1, $black, $font, $text);$im1 = imagecreatetruecolor($width, $height);
$white = imagecolorallocate($im1, 255, 255, 255);
$black = imagecolorallocate($im1, 0, 0, 0);
imagefilledrectangle($im1, 0, 0, $width, $height, $white);$k = 3;$xo = -1;
$yo = -1;
for($y=0; $y<imagesy($im); $y+=$k) {
for($x=0; $x<imagesx($im); $x+=$k) {
if(imagecolorat($im, $x, $y) == 0) {
if($xo < 0) $xo = $x;
else imageline($im1, $xo, $y, $x, $y, $black);
}else $xo = -1;
}
}imagepng($im1);
imagedestroy($im);
imagedestroy($im1);