Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/243.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 如何在zend form captcha中创建具有读写访问权限的路径_Php_Zend Framework_Captcha - Fatal编程技术网

Php 如何在zend form captcha中创建具有读写访问权限的路径

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' =>

我已经添加了Zend格式的验证码。在此验证码中,图像自动生成并保存在验证码文件夹中

在服务器(AWS)中访问时,在html页面中,不会加载captcha图像,因为路径不可读写

下面是我用来创建带有captcha的zend表单的代码:

$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);
}