@Snapey or here it is sir have a look
This is the my index.php file code
<?php
echo $_SERVER['REQUEST_URI'];
$uri = parse_url($_SERVER['REQUEST_URI'])['path'];
$routes = [
'/' => '/index.php',
'/register' => '/register.php',
'/login' => '/forms/login/login.php',
'/logout' => '/forms/logout/logout.php',
'/admin/profile' => '/forms/admin/index.php',
'/contact' => 'controllers/contact.php',
];
// function routeToController($uri, $routes) {
if (array_key_exists($uri, $routes)) {
require __DIR__ . $routes[$uri];
} else {
echo "404 page not found!";
}
?>
as i have written in line 2 echo $_SERVER['REQUEST_URI']; when i run this in the browser i am getting this error and why this line is executing many times ? 🤷♂️
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
it shows this line means i have set this to main index page call on this url. It shows many time untill the memory exhausted why ?
Fatal error: Allowed memory size of 536870912 bytes exhausted (tried to allocate 12288 bytes) in C:\laragon\www\php e-commerce project\index.php on line 19