这篇文章主要介绍了php如何实现点击即可刷新验证码,代码很详细,值得大家学习,感兴趣的小伙伴们可以参考一下
验证码类文件 CreateImg.class.php
width=$width;
$this->height=$height;
$this->codenum=$codenum;
}
function outImg()
{
//输出头
$this->outFileHeader();
//产生验证码
$this->createCode();
//产生图片
$this->createImage();
//设置干扰像素
$this->setDisturbColor();
//往图片上写验证码
$this->writeCheckCodeToImage();
imagepng($this->checkimage);
imagedestroy($this->checkimage);
}
private function outFileHeader()
{
header ("Content-type: image/png");
}
private function createCode()
{
$this->checkcode = strtoupper(substr(md5(rand()),0,$this->codenum));
}
private function createImage()<