Answers for "how to set optional third parameter in routes of codeigniter"

PHP
0

codeigniter4 route optional parameter

$routes->get('logout', 'Login::logout')
$routes->get('logout/(:any)', 'Login::logout/$1')
$routes->get('logout/(:any)/(:any)', 'Login::logout/$1/$2')
$routes->get('logout/(:any)/(:any)/(:any)', 'Login::logout/$1/$2/$3')
$routes->get('logout/(:any)/(:any)/(:any)/(:any)', 'Login::logout/$1/$2/$3/$4')
$routes->get('logout/(:any)/(:any)/(:any)/(:any)/(:any)', 'Login::logout/$1/$2/$3/$4/$5')
Posted by: Guest on April-07-2021
0

how to set optional third parameter in routes of codeigniter

$routes->get('logout/(:any)', 'Login::logout/$1');
$routes->get('logout', 'Login::logout'); 

public function logout($param1 = null, $param2 = null, $param3 = null)
{
    var_dump($param1, $param2, $param3); exit;
}
Posted by: Guest on April-06-2021

Code answers related to "how to set optional third parameter in routes of codeigniter"

Browse Popular Code Answers by Language