Captcha 操作
所有具体的 CAPTCHA 对象实现
interface Zend_Captcha_Adapter extends Zend_Validate_Interface { public function generate(); public function render(Zend_View $view, $element = null); public function setName($name); public function getName(); public function getDecorator(); // Additionally, to satisfy Zend_Validate_Interface: public function isValid($value); public function getMessages(); public function getErrors(); }
增变器和访问器用于指定和获取 captcha 的标识符。
一般的用例如下: // Originating request: $captcha = new Zend_Captcha_Figlet(array( 'name' => 'foo', 'wordLen' => 6, 'timeout' => 300, )); $id = $captcha->generate(); echo $captcha->render(); // On subsequent request: // Assume captcha setup as before, and $value is the submitted value: if ($captcha->isValid($_POST['foo'], $_POST)) { // Validated! }
|