function validatecaptcha($captcha) { $captchaid = $captcha['id']; $captchainput = $captcha['input']; $captchasession = new zend_session_namespace('zend_form_captcha_' . $captchaid); $captchaiterator = $captchasession->getiterator(); zend_debug::dump($captchaiterator);exit; $captchaword = $captchaiterator['word']; if($captchaword) { if( $captchainput != $captchaword ){ return false; } else { return true; } } else { return false; } } public function indexaction() { $captchaid = $this->generatecaptcha(); $this->view->captchaid = $captchaid; if(isset($_post['captcha'])) { $captcha = $_post['captcha']; if( $this->validatecaptcha($captcha) ) { $this->view->message = 'yes'; } else { $this->view->message = 'no'; } } }}?>
复制代码