0

我已经制作了 .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”错误,但我已经定义了路线。

4

1 回答 1

1

尝试$router->setBasePath('/rimaxxApi');

于 2016-09-20T14:14:13.703 回答