<?php require_once 'model.php'; require_once 'controllers.php'; // route the request internally $uri = parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH); if ('/index.php' == $uri || '/' == $uri) { list_action(); } elseif (('/index.php/show' == $uri || '/show' == $uri) && isset($_GET['id'])) { show_action($_GET['id']); } else { header('Status: 404 Not Found'); echo '<html><body><h1>Page Not Found</h1></body></html>'; }
<?php /** * точка входа в программу * подгружение model,controller. */ echo $_SERVER["REQUEST_URI"]; $uri = $_SERVER["REQUEST_URI"]; $u = explode('?', $uri); $uri = $u[0]; echo "<br>newUri=" . $uri; if ($uri == "/2ktvrp/subbotin/" or $uri == "/2ktvrp/subbotin/index.php") { $response = list_action(); } elseif ($uri == "/2ktvrp/subbotin/index.php/admin") { $response = admin_action(); } elseif ($uri == "/2ktvrp/subbotin/index.php/autor") { $response = autor_action(); } elseif ($uri == "/2ktvrp/subbotin/index.php/about") { $response = about_action(); } elseif ($uri == "/2ktvrp/subbotin/index.php/show") { $response = show_action($_REQUEST['id']); } elseif ($uri == "/2ktvrp/subbotin/index.php/edit") { $response = edit_action($_REQUEST['id']); } elseif ($uri == "/2ktvrp/subbotin/index.php/edit_submit") { $response = admin_action(); } elseif ($uri == "/2ktvrp/subbotin/index.php/delete") { $response = delete_action($_REQUEST['id']); } elseif ($uri == "/2ktvrp/subbotin/index.php/add") { $response = add_action(); } elseif ($uri == "/2ktvrp/subbotin/index.php/users") { $response = users_action();