【问题标题】:alto router doesn't route correctlyalto 路由器路由不正确
【发布时间】:2016-03-16 10:34:44
【问题描述】:

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

【问题讨论】:

    标签: php .htaccess altorouter


    【解决方案1】:

    试试$router-&gt;setBasePath('/rimaxxApi');

    【讨论】:

      猜你喜欢
      • 2013-06-29
      • 1970-01-01
      • 2020-03-18
      • 1970-01-01
      • 2020-07-29
      • 1970-01-01
      • 2015-04-14
      • 1970-01-01
      • 2021-04-27
      相关资源
      最近更新 更多