0

I need help. I am currently trying to use PHP route AltoRouter but it does not work for me. Here is my code:

require_once __DIR__ . '/vendor/autoload.php';

$router = new AltoRouter();

$router->map('GET', '/', function(){

    echo 'It is working';
});

$match = $router->match();

// Here comes the new part, taken straight from the docs:

// call closure or throw 404 status
if( $match && is_callable( $match['target'] ) ) {
   
   call_user_func_array( $match['target'], $match['params'] );

} else {

   // no route was matched
   header( $_SERVER["SERVER_PROTOCOL"] . ' 404 Not Found');

}

My browser output: My browser output

The existing list of answers I found are still not working for my code. I need help please. It's totally messing with my head. THANK YOU VERY MUCH!

The current answers I found that did not solve for me:

PHP AltoRouter - can't get GET request
Routing via Php AltoRouter

segFault
  • 3,887
  • 1
  • 19
  • 31

0 Answers0