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

we are a community of more than 2 million smartest coders
registration for
employee referral programs
are now open
get referred to google, amazon, flipkart and more
register now
  
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}