【问题标题】:Altorouter router->map() is not working as expectedAltorouter router->map() 未按预期工作
【发布时间】:2018-09-22 21:12:06
【问题描述】:
$router->setBasePath('/ecommerce/public');
$router->map( 'GET', '/', '', 'about_us' );
$match = $router->match();

当我重新加载 index.php 页面时工作正常。 var_dump($match) 显示了预期的结果;

然而,

$router->map( 'GET', '/about', '', 'about_us' )  

当我输入 localhost/about 时不工作。浏览器显示“找不到对象”错误。

我怀疑可能是我的根目录设置不正确,所以我也在$router->map()上面放了following

$router->setBasePath('/ecommerce/public');

很遗憾,setBasePath 不是解决方案。

【问题讨论】:

    标签: php rest altorouter


    【解决方案1】:

    您是否在 .htaccess 中尝试过任何重写规则?

    试试这个

    RewriteEngine on
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule . index.php [L]
    

    【讨论】:

      猜你喜欢
      • 2017-03-01
      • 2017-05-16
      • 2022-01-27
      • 1970-01-01
      • 1970-01-01
      • 2022-01-22
      • 1970-01-01
      • 2021-06-04
      相关资源
      最近更新 更多