Öz MVC çärimizdä router ulanylmagy
index.php faýlynyň häzirki mazmunyny ýada salalyň:
<?php
namespace Core;
error_reporting(E_ALL);
ini_set('display_errors', 'on');
spl_autoload_register(function($class) {
// siziň awtogirlendirme amal etmäňiz
});
$routes = require $_SERVER['DOCUMENT_ROOT'] . '/project/config/routes.php';
?>
Indi index.php faýlynda routerymyzy
aşakdaky ýaly ulanmak isleýäris:
<?php
$router = new Router();
$track = $router->getTrack($routes, $_SERVER['REQUEST_URI']);
?>
Has giňişleýin ýazmak bolýar:
<?php
$track = ( new Router ) -> getTrack($routes, $_SERVER['REQUEST_URI']);
?>