Php 如何在zend form captcha中创建具有读写访问权限的路径
我已经添加了Zend格式的验证码。在此验证码中,图像自动生成并保存在验证码文件夹中 在服务器(AWS)中访问时,在html页面中,不会加载captcha图像,因为路径不可读写 下面是我用来创建带有captcha的zend表单的代码:Php 如何在zend form captcha中创建具有读写访问权限的路径,php,zend-framework,captcha,Php,Zend Framework,Captcha,我已经添加了Zend格式的验证码。在此验证码中,图像自动生成并保存在验证码文件夹中 在服务器(AWS)中访问时,在html页面中,不会加载captcha图像,因为路径不可读写 下面是我用来创建带有captcha的zend表单的代码: $captcha = new Zend_Form_Element_Captcha('captcha', array( 'captcha' =>
$captcha = new Zend_Form_Element_Captcha('captcha', array(
'captcha' => array(
'captcha' => 'Image',
'wordLen' => 5,
'timeout' => 300,
'expiration' => 300,
'font' => './fonts/calibri_bold.ttf',
'imgDir' => './captcha/',
'imgUrl' => '/captcha/'
)
));
$captcha->removeDecorator('ViewHelper');
如何使imgDir
路径具有读写访问权限
非常感谢您的帮助。提前感谢。我通过在php中查找验证码图像路径并提供读取图像文件的权限,解决了这个问题。代码如下:
public function giveCaptchaFolderAccess() {
$Path = realpath("../public/captcha");
$dp = opendir($Path);
while ($File = readdir($dp)) {
if ($File != "." AND $File != "..") {
if (is_dir($File)) {
chmod($File, 0744);
chmod_r($Path . "/" . $File);
} else {
chmod($Path . "/" . $File, 0744);
}
}
} closedir($dp);
}