public function index01Action() { echo "<h3 style='color:red;font-weight:bold'>" . __METHOD__ . "</h3>"; //Tạo đối tượng chaptcha Image $captchaImg = new \Zend\Captcha\Image(); //Thiết lập đường dẫn đấn thư mục hình ảnh chứa captcha $captchaImg->setImgDir(CAPTCHA_PATH . "images"); //Thiết lập url cho hình ảnh captcha $captchaImg->setImgUrl(CAPTCHA_URL . "images"); //Thiết lập font $captchaImg->setFont(CAPTCHA_PATH . "fonts/Vharis.ttf"); //font-size $captchaImg->setFontSize(30); //length-char $captchaImg->setWordlen(5); //width-height cho captcha $captchaImg->setWidth(180); $captchaImg->setHeight(70); //set dấu chấm và đường chéo $captchaImg->setDotNoiseLevel(70); $captchaImg->setLineNoiseLevel(5); //Thiết lập ký tự xuất hiện AbstractWord::$VN = array("t"); AbstractWord::$CN = array("r"); //Phát sinh captcha $captchaImg->generate(); $imgUrl = $captchaImg->getImgUrl() . $captchaImg->getId() . $captchaImg->getSuffix(); return new ViewModel(array("imgUrl" => $imgUrl)); }