codeigniter4 route optional parameter

Solutions on MaxInterview for codeigniter4 route optional parameter by the best coders in the world

showing results for - "codeigniter4 route optional parameter"
Gabriele
29 Feb 2019
1$routes->get('logout', 'Login::logout')
2$routes->get('logout/(:any)', 'Login::logout/$1')
3$routes->get('logout/(:any)/(:any)', 'Login::logout/$1/$2')
4$routes->get('logout/(:any)/(:any)/(:any)', 'Login::logout/$1/$2/$3')
5$routes->get('logout/(:any)/(:any)/(:any)/(:any)', 'Login::logout/$1/$2/$3/$4')
6$routes->get('logout/(:any)/(:any)/(:any)/(:any)/(:any)', 'Login::logout/$1/$2/$3/$4/$5') 
Amir
30 Jun 2017
1$routes->get('logout/(:any)', 'Login::logout/$1');
2$routes->get('logout', 'Login::logout'); 
3
4public function logout($param1 = null, $param2 = null, $param3 = null)
5{
6    var_dump($param1, $param2, $param3); exit;
7}