Altorouter路由器-> map()无法正常工作

时间:2018-09-22 21:12:06

标签: php rest altorouter

$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()

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

不幸的是,setBasePath不是解决方案。

1 个答案:

答案 0 :(得分:0)

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

尝试这个

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