I have the following code,but what I got is broken link ! I have installed GD library and the proper font ! but nothing work ,so how to I can use image captcha in zendframework without broken link ,what the wrong ?
$captcha = new Zend_Form_Element_Captcha('Captcha',arr开发者_如何学编程ay(
'captcha' => array('captcha' => 'Image', 'wordLen' => 6,
'timeout' => 300, 'width' => 300, 'height' => 100,
'imgUrl' => '/captcha',
'imgDir' => APPLICATION_PATH . '/../public/captcha',
'font' => APPLICATION_PATH . '/../public/fonts/LiberationSansRegular.ttf')));
//sorry
Try using:
'/public/captcha'
Instead of:
APPLICATION_PATH . '/../public/captcha'
--
What I did in my application was add a couple of lines in the main index.php file to have direct access to the public
folder using a constant variable:
// Define path to public directory
defined('PUBLIC_PATH')
|| define('PUBLIC_PATH', realpath(dirname(__FILE__) . '/../public'));
Then just use:
PUBLIC_PATH . '/captcha'
I found the problem.. It comes from : )
if ( in_array( strtolower( ini_get( 'magic_quotes_gpc' ) ), array( '1', 'on' ) ) ) {
$_POST = array_map( 'stripslashes', $_POST );
$_GET = array_map( 'stripslashes', $_GET );
$_COOKIE = array_map( 'stripslashes', $_COOKIE );
}
APPLICATION_PATH . '/../public/captcha' must exist and apache/php must have write access to it.
精彩评论