私はAltoRouterを使用しようとしていますが、そのドキュメントに従おうとしていますが、私の問題は$_GET
常に空であることです。
私は Apache を使用しており、.htaccess は次のようになっています。
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule . index.php [L]
そして今、これは$_GET
ルーターを取得して作成するための私のファイルです:
$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();
}
$_GET を受け取ったときは常に空なので、print_r($_GET)
to 内を参照するためにa を使用し$_GET
ましたが、空の配列が返されました。
以下のURLで試してみましたが、結果は同じでした。
http://localhost/mvc/
http://localhost/mvc/page
http://localhost/mvc/controller
http://localhost/mvc/produto/cadastrar