matchCurrentRequest() public method

Matches the current request against mapped routes
public matchCurrentRequest ( )
示例#1
0
 public function testMatchRouterUsingBasePath()
 {
     $collection = new RouteCollection();
     $collection->attach(new Route('/users/', array('_controller' => 'PHPRouter\\Test\\SomeController::usersCreate', 'methods' => 'GET')));
     $router = new Router($collection);
     $router->setBasePath('/localhost/webroot');
     foreach ($this->serverProvider() as $server) {
         $_SERVER = $server;
         self::assertTrue((bool) $router->matchCurrentRequest());
     }
 }
示例#2
0
 public function testMatchRouterUsingBasePath()
 {
     $collection = new RouteCollection();
     $collection->attach(new Route('/users/', array('_controller' => 'PHPRouter\\Test\\SomeController::users_create', 'methods' => 'GET')));
     $router = new Router($collection);
     $router->setBasePath('/localhost/webroot');
     $_SERVER = [];
     $_SERVER['REQUEST_METHOD'] = 'GET';
     $_SERVER['REQUEST_URI'] = '/localhost/webroot/users/';
     $_SERVER['SCRIPT_NAME'] = 'index.php';
     $this->assertTrue((bool) $router->matchCurrentRequest());
 }
$collection->attachRoute(new Route('/admin/descuentos/setDescuento/', array('_controller' => 'usuariosController::setDescuento', 'methods' => 'POST')));
//-------acceso para administradores para obtener los descuentos------
$collection->attachRoute(new Route('/admin/descuentos/getDescuentos/', array('_controller' => 'usuariosController::getDescuentos', 'methods' => 'POST')));
//-------acceso para administradores para eliminar los descuentos------
$collection->attachRoute(new Route('/admin/descuentos/delDescuento/', array('_controller' => 'usuariosController::delDescuento', 'methods' => 'POST')));
//-------acceso para administradores para actualizar los datos de un descuento------
$collection->attachRoute(new Route('/admin/descuentos/updateDescuento/', array('_controller' => 'usuariosController::updateDescuento', 'methods' => 'POST')));
//-------acceso para imprimir tabla de eventos------
$collection->attachRoute(new Route('/admin/imprimirTablaAdmin/', array('_controller' => 'usuariosController::imprimirTablaAdmin', 'methods' => 'GET')));
//-------Modificacion de datos updatePago------
$collection->attachRoute(new Route('/admin/updatePago/', array('_controller' => 'usuariosController::updatePago', 'methods' => 'POST')));
//-------Modificacion de datos updateMaterial------
$collection->attachRoute(new Route('/admin/updateMaterial/', array('_controller' => 'usuariosController::updateMaterial', 'methods' => 'POST')));
//-------imprimir datos a excel------
$collection->attachRoute(new Route('/admin/reporteExcel/', array('_controller' => 'cReportes::Excel', 'methods' => 'POST')));
//-------obtencion de relacion participantes eventos ------
$collection->attachRoute(new Route('/admin/getRelEventosParticipantes/', array('_controller' => 'usuariosController::getRelEventosParticipantes', 'methods' => 'POST')));
//-------obtencion de relacion participantes en grupo de un evento ------
$collection->attachRoute(new Route('/admin/getRelEventosParticipantesGrupos/', array('_controller' => 'usuariosController::getRelEventosParticipantesGrupos', 'methods' => 'POST')));
$collection->attachRoute(new Route('/admin/fichas/', array('_controller' => 'usuariosController::getAdjuntos', 'methods' => 'POST')));
$collection->attachRoute(new Route('/admin/adjunto/', array('_controller' => 'usuariosController::delAdjuntos', 'methods' => 'POST')));
$collection->attachRoute(new Route('/admin/delComentarios/', array('_controller' => 'usuariosController::delComentarioAdmin', 'methods' => 'POST')));
$collection->attachRoute(new Route('/admin/reporteAccesos/', array('_controller' => 'usuariosController::reporteAccesos', 'methods' => 'GET')));
$collection->attachRoute(new Route('/admin/reporteAccesos/', array('_controller' => 'usuariosController::getReporteAccesos', 'methods' => 'POST')));
$router = new Router($collection);
$router->setBasePath('/');
$route = $router->matchCurrentRequest();
if (!$route) {
    $page = new someController();
    $page->page404();
}