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 java报错:使用mybatis plus查询一个只返回一条数据的sql,却报错返回了1000多条
  • ¥15 Python报错怎么解决
  • ¥15 simulink如何调用DLL文件
  • ¥15 关于用pyqt6的项目开发该怎么把前段后端和业务层分离
  • ¥30 线性代数的问题,我真的忘了线代的知识了
  • ¥15 有谁能够把华为matebook e 高通骁龙850刷成安卓系统,或者安装安卓系统
  • ¥188 需要修改一个工具,懂得汇编的人来。
  • ¥15 livecharts wpf piechart 属性
  • ¥20 数学建模,尽量用matlab回答,论文格式
  • ¥15 昨天挂载了一下u盘,然后拔了