我已经创建了.htaccess文件,但是alto路由器的路由不是
<?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”错误,但我已经定义了路由。
答案 0 :(得分:1)
尝试$router->setBasePath('/rimaxxApi');