I have my route:
$di->set('router', function () {
$router = new Router(false);
$router->setDefaultModule("backend");
$router->setDefaultAction('index');
$router->notFound(array(
'module' => 'public',
'controller' => 'error',
'action' => 'index'
));
$router->add('/', array(
'module' => 'public',
'controller' => 'login',
'action' => 'index',
));
$router->add('/:module/:controller', array(
'module' => 1,
'controller' => 2,
'action' => 'index',
));
$router->add('/:module/:controller/{param:[a-z]+}\.(html|json|xml)', array(
'module' => 1,
'controller' => 2,
'action' => 3,
'params' => 4
));
$router->add('/:module/:controller/([a-z]+)\.(json|html)/:params', array(
'module' => 1,
'controller' => 2,
'action' => 3,
'type' => 4,
'params' => 5
));
return $router;
});
On controller:
public function changeLanguageAction($lang = NULL) {
var_dump($lang);
die();
}
the problem is:
if the uri: https://feedback/public/kernel/changelanguage.html/es
response: string(2) "es"
if the uri: https://feedback/public/kernel/changelanguage.html/en
response: string(2) "en"
But if the uri: https://feedback/public/kernel/changelanguage.html
response: string(4) "html"
I want that if not params after the action_name.(html/json/xml) var_dump show NULL
Any Help!