示例#1
0
 public function __construct($name, $param = array())
 {
     parent::__construct($name, $param);
     if (!file_exists(PATH_ROOT . '/' . DIR_CACHE . '/captcha')) {
         mkdir(PATH_ROOT . '/' . DIR_CACHE . '/captcha');
         chmod(PATH_ROOT . '/' . DIR_CACHE . '/captcha', 0777);
     }
     $opt = new data(array('font' => PATH_ROOT . '/' . DIR_LIBRARY . '/font/arial.ttf', 'imgDir' => PATH_ROOT . '/' . DIR_CACHE . '/captcha', 'imgUrl' => '/' . DIR_CACHE . '/captcha', 'wordlen' => 4, 'dotNoiseLevel' => 0, 'lineNoiseLevel' => 0, 'fsize' => 20, 'width' => 100, 'height' => 60));
     if (isset($param['captcha'])) {
         $opt->set($param['captcha']);
     }
     $this->captcha = new Zend\Captcha\Image($opt->to_array());
     $this->validator['captcha'] = array('captcha' => $this->captcha);
 }