First Routing

First Routing

Routing operations on e-mvc are provided via controller. By calling the Route:: class on the route.php file, it will be sufficient to specify the method you want to use, the page name, the controller name and the method name.

<?php 

use System\Route\Route;

Route::get('/', '/default/index');

Parameter Value

If we want to get an additional parameter from the user to the page, we need to specify it additionally in Route:: with regex. Otherwise, your page will get a 404 error.

The additional parameter sent can be captured as a value in the controller.

<?php 

use System\Route\Route;

Route::get('/page/([0-9a-zA-Z-_]+)', '/default/index');

Multiple Parameter values

If we want to get multiple parameter values, this is possible with e-mvc. You can get more than one parameter if you want.

You can provide redirection to special pages according to the number of incoming parameters.

<?php 

use System\Route\Route;

Route::get('/([0-9a-zA-Z-_]+)', '/default/index');
Route::get('/([0-9a-zA-Z-_]+)/([0-9a-zA-Z-_]+)', '/main/index');