Example of Routes (app\Config\Routes.php):
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | <?php use CodeIgniter\Router\RouteCollection; /** * @var RouteCollection $routes */ $routes->get('/', 'Home::index'); $routes->get('gaming', 'Home::gaming'); $routes->get('gaming/(:any)', 'Home::gaming/$1'); $routes->match(['get', 'post'], '/reactApiData', 'Home::reactApiData'); //$routes->match(['get', 'post'], '/programme-page', 'Programme::programme_page'); //$routes->match(['get', 'post'], '/programme-page', 'Programme::programme_page'); |
Using parameter (:any)
1 2 3 4 5 6 7 8 9 10 11 12 | <?php use CodeIgniter\Router\RouteCollection; /** * @var RouteCollection $routes */ $routes->get('/', 'Home::index'); $routes->match(['get', 'post'], 'admin/configurator/configurator/view-order', 'admin\configurator\Configurator::view_order'); // For /view-order without a parameter $routes->match(['get', 'post'], 'admin/configurator/configurator/view-order/(:any)', 'admin\configurator\Configurator::view_order/$1'); // For /view-order/xyz with a parameter $routes->match(['get', 'post'], 'admin/configurator/configurator', 'admin\configurator\Configurator::index'); // For the main configurator page $routes->match(['get', 'post'], 'admin/configurator/configurator/(:any)', 'admin\configurator\Configurator::$1'); |