我最终放弃使用Zend_Form_Element_Hash,而是手动创建了一个令牌,并在Zend_Session中进行了注册,然后在提交时进行了检查。
form.php
$myNamespace = new Zend_Session_Namespace('authtoken');$myNamespace->setExpirationSeconds(900);$myNamespace->authtoken = $hash = md5(uniqid(rand(),1));$auth = new Zend_Form_Element_Hidden('authtoken');$auth->setValue($hash) ->setRequired('true') ->removeDecorator('HtmlTag') ->removeDecorator('Label');controller.php
$mysession = new Zend_Session_Namespace('authtoken');$hash = $mysession->authtoken;if($hash == $data['authtoken']){ print "success";} else { print "you fail";}这似乎有效,并且仍然使事情相对理智和安全。我仍然希望使用Hash元素,但似乎无法使其与AJAX一起使用。
谢谢大家



