0

这是我的文件夹结构

+ Duplicate
    + Controllers
        - LoginController.php
    + Models
    + Views
        - Index.php

我的 http-vhosts.conf 文件的内容是:

ServerName example.dev
ServerAlias www.example.dev
DocumentRoot "C:/wamp/www/Duplicate/Views/"
<Directory "C:/wamp/www/Duplicate/Views/"> 

我的索引文件包含这样的标题

header("Location: ../Controllers/LoginController.php");

永远不会被LoginController加载。这就是我对正在发生的事情的理解。

URL example.dev始终包含/Views/,因此即使我尝试将Location标头更改为父文件夹,路径也会附加到我的example.dev URL 中,该 URL 再次包含/Views/

我该怎么做才能让它工作。我整天都在试图让它加载页面。

4

1 回答 1

0

使用此设置,您无法访问 LoginController.php,因为它与 DocumentRoot 不同。

DocumentRoot = C:/wamp/www/Duplicate/Views/
File         = C:/wamp/www/Duplicate/Controllers/LoginController.php

只能对 DocumentRoot(或其任何子文件夹)中的文件进行直接访问。

您也许可以将 DocumentRoot 更改为“C:/wamp/www/Duplicate/”并将 index.php 放入该文件夹中,将您重定向到“Views/”。

于 2013-07-29T11:19:28.697 回答