CodeIgniter使用Securimage驗證碼方式

1 https://www.phpcaptcha.org/ 下載後解壓縮到application\libraries\securimage
2 controller中新增function

	function securimage() {
		$this->load->library('securimage');
		$img = new Securimage();
		$img->show();
	}

3 view裡面增加

<img id="captcha" src="<?=site_url('[controller classname]/securimage')?>" alt='captcha' id='captcha' />
<a href="#" onclick=" document.getElementById('captcha').src = document.getElementById('captcha').src + '?' + (new Date()).getMilliseconds()">重新產生驗證碼</a>

4 驗證

$captchacode= $this->input->post('captchacode');
$this->load->library('securimage');
if ($this->securimage->check($captchacode)==true){
  redirect('index');
}