我已经制作了.htaccess文件并且有效,但是中音路由器的路由不起作用
<?php
require 'altorouter.php';
$router = new AltoRouter();
$router->setBasePath('/rimaxxApi/');
$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');
}
?>
路径位于子文件夹中
使用此代码,我不断收到"404"错误,但我已定义路由。
尝试$router->setBasePath('/rimaxxApi');