public beforeMatch (mixed $callback)
Sets a callback that is called if the route is matched. The developer can implement any arbitrary conditions here If the callback returns false the route is treated as not matched
$router->add('/login', array( 'module' => 'admin', 'controller' => 'session' ))->beforeMatch(function ($uri, $route) { // Check if the request was made with Ajax if ($_SERVER['HTTP_X_REQUESTED_WITH'] == 'xmlhttprequest') { return false; } return true; });
Please login to continue.