这是我的文件夹结构
+ 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
从未加载。这就是我对正在发生的事情的理解。
URLexample.dev总是包含/Views/,所以即使我试图将Location标题更改为父文件夹,路径也会附加到我的example.devURL中,该URL再次包含>/Views/。
我该怎么做才能让它发挥作用。我整天都在努力让它加载页面。
使用此设置,您无法访问LoginController.php,因为它与DocumentRoot不同。
DocumentRoot = C:/wamp/www/Duplicate/Views/
File = C:/wamp/www/Duplicate/Controllers/LoginController.php
只能对DocumentRoot(或其任何子文件夹)中的文件进行直接访问。
您也许可以将DocumentRoot更改为"C:''/wamp/www/Dduplicate/",并在该文件夹中放入一个index.php,将您重定向到"Views/"。