目前,我正在使用Zend框架开发一个web应用程序。
我的问题是,我必须为我的localhost (运行XAMPP的窗口环境)和web托管(linux环境)的captcha元素编写2组代码。
我的问题是,有没有更好的方法来编码它,让它在我的本地主机和虚拟主机环境中都能工作?目前,当我上传到web主机环境时,一直在更改代码是非常烦人的。
提前谢谢你了。:)
这是我的虚拟主机环境的代码
array('captcha' => array(
'captcha' => 'Image',
'wordLen' => 3,
'timeout' => 600,
'font' => '../font/arial.ttf',
'imgurl' => '../images/captcha/',
'fontsize' =>20,
'expiration' =>20,
'lineNoiseLevel' =>0,
'DotNoiseLevel' =>10,
)
)
);它在web主机上工作得很好,但是如果我在我的本地主机窗口环境中运行它,我得到的是空白验证码,文本不会生成。
这就是我当前为我的本地主机准备的,它工作得很好。
array('captcha' => array(
'captcha' => 'Image',
'wordLen' => 3,
'timeout' => 600,
'font' => 'C:\WINDOWS\Fonts\arial.ttf',
'imgurl' => 'http://localhost/images/captcha',
'fontsize' =>20,
'expiration' =>20,
'lineNoiseLevel' =>0,
'DotNoiseLevel' =>10,
)
)
);发布于 2011-04-01 14:13:50
使用APPLICATION_PATH作为字体。http://framework.zend.com/manual/en/zend.captcha.adapters.html的默认值是“./image/captcha/”。所以不需要。希望能对你有所帮助。
https://stackoverflow.com/questions/5509505
复制相似问题