无法提供目录没有匹配的目录Zend Framework

时间:2018-02-16 19:38:14

标签: php .htaccess zend-framework2

我试图在Zend Framework应用中的公共文件夹下的一个目录中显示所有视频的列表。但是,当我尝试加载它们时,我遇到了错误

[Fri Feb 16 14:25:24.903182 2018] [autoindex:error] [pid 6572:tid 2008] [client ::1:59747] AH01276: Cannot serve directory C:/xampp/htdocs/public/images/profile/fooboy/videos/: No matching DirectoryIndex (index.php) found, and server-generated directory index forbidden by Options directive, referer: http://localhost/members

现在,当我加载并显示来自同一目录的图像列表时,不会发生错误,但它会对视频目录执行此操作。

这是我在控制器中的php代码:

$video_dir = @array_diff(scandir(getcwd() . '/public/images/profile/' . $params . '/videos/', 1), array('.', '..', 'current', '.htaccess', 'albums', 'edited_photos'));

if (count($video_dir) > 0) {
    $videos = array();

    foreach ($video_dir as $video) {
       $videos[] = "<video width=\"200\" height=\"150\">
           <source src=\"$video\" type=\"video/mp4\">
           </video>";
    }

    natsort($videos);

    $layout->setVariable('my_videos', $videos);
}

观点:

<div id="side-5" class="w3-accordion-content w3-container">
    <div class="w3-row-padding" id="left-videos">
        <?php
            if (count($this->layout()->my_videos) > 0):
                foreach ($this->layout()->my_videos as $vids):
        ?>

            <div class="w3-half">
                <?php echo $vids; ?>
            </div>

            <?php
                 endforeach;
            else:
            ?>
               <p>Upload <a href="<?php echo $this->url('members/profile', array('action' => 'upload-file')); ?>">videos</a>!</p> 
            <?php

            endif;
            ?>
    </div>
</div>

我认为它可能是一个与htaccess文件相关的问题,所以这里是我所拥有的htaccess文件:

 Options -Indexes
 RewriteEngine on 
 RewriteCond %{HTTP_REFERER} !^$ 
 RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?localhost [NC]
 RewriteRule \.(jpg|jpeg|png|gif)$ - [NC,F,L]

以防万一它有帮助,这是目录的截图:

enter image description here

任何帮助都将不胜感激。

谢谢!

(对不起,如果这可能是一个重复的问题,我只是找不到Zend Framework 2的任何内容)

1 个答案:

答案 0 :(得分:0)

没关系,这是路径错误,对不起。

相关问题