author:咔咔
wechat:fangkangfk、
/**
* author:咔咔
*
* 验证码
*/
public function codeAction() {
Header("Content-type: image/PNG");
$rand ="";
for($i=0;$i<4;$i++){
$rand.=dechex(rand(0,15));
}
$im = imagecreate(100,30);
$gray = ImageColorAllocate($im,200,200);
for($i=0;$i<3;$i++){
$te=imagecolorallocate($im,rand(0,255),255));
}
imagefill($im,$gray);
while(($rand=rand()%100000)<10000);
$_SESSION['rand']=$rand;
imagestring($im,5,30,10,$rand,$te);
for($i=0;$i<200;$i++)
{
$randcolor = ImageColorallocate($im,255));
imagesetpixel($im,rand()%100,rand()%50,$randcolor);
}
imageline($im,100),100,15),$randcolor);
imageline($im,$randcolor);
ImagePNG($im);
ImageDestroy($im);
}
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。