how to set optional third parameter in routes of codeigniter

Solutions on MaxInterview for how to set optional third parameter in routes of codeigniter by the best coders in the world

showing results for - "how to set optional third parameter in routes of codeigniter"
Riccardo
04 Apr 2016
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') 
Katia
03 Jun 2020
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}