I'm trying to use AltoRouter, but I'm trying to follow its documentation and my problem is that $_GET
always to be empty.
I'm using Apache, and my .htaccess is like the following:
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule . index.php [L]
And now this is my file to take the $_GET
and make the router:
$router->map('GET', '/', 'PageController@getShowHomePage', 'home');
$match = $router->match();
list($controller, $method) = explode("@", $match['target']);
if(is_callable(array($controller, $method))) {
$object = new $controller();
call_user_func_array(array($object, $method), array($match['params']));
} else {
echo "Cannot find $controller -> $method";
exit();
}
But I see that it ins't work, because when I'm receiving the $_GET, it's always empty, I used a print_r($_GET)
to see within to $_GET
, but was returned to me a array empty.
I tried with the followings URL's, but the result was the same:
http://localhost/mvc/
http://localhost/mvc/page
http://localhost/mvc/controller
http://localhost/mvc/produto/cadastrar