duannian4784 2011-07-05 07:37
浏览 78

zend框架中的验证码图像

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',array(
        '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

  • 写回答

3条回答 默认 最新

  • dongnan4571 2011-07-11 17:52
    关注

    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'
    
    评论

报告相同问题?

悬赏问题

  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 保护模式-系统加载-段寄存器
  • ¥15 电脑桌面设定一个区域禁止鼠标操作
  • ¥15 求NPF226060磁芯的详细资料