I try to build a little router system in my project and everything should work. but i get this error:
Warning: require_once(../view/homeView.php): Failed to open stream: No such file or directory in C:\xampp\htdocs\MyShop\MyShop\MVC\controller\homeController.php on line 3
I dont't know what to do because the homeView.php is in /MVC/view/homeView.php.
this are the files:
index.php
<?php
$request = $_SERVER['REQUEST_URI'];
switch ($request)
{
case "/MyShop/MyShop/":
case "/MyShop/MyShop/home":
require __DIR__ . "/MVC/controller/homeController.php";
break;
case "/MyShop/MyShop/shop":
require __DIR__ . "/MVC/controller/produkteController.php";
break;
case "/MyShop/MyShop/profil":
require __DIR__ . "/MVC/controller/profilController.php";
break;
case "/MyShop/MyShop/registrieren":
require __DIR__ . "/MVC/Controller/registrierenController.php";
break;
default:
echo "seite nicht gefunden";
}
homeController.php
<?php
require_once "../view/homeView.php";
require_once "../view/grundseiteView.php";
the directory structure looks like this
∟MyShop
-index.php
∟MVC
∟controller
-homeController.php
∟view
-homeView.php
-grundseiteView.php
If I put the view files in the controller directory, it works. But I don't know why it doesn't work now. maybe someone can help me