嗨,我想在 wamp 中使用名为 Alto Router 的包。
在 www root 我更改了索引页
<?php
require( __DIR__ . "/vendor/autoload.php");
$router = new AltoRouter();
$router->map('GET','/',function(){
include(__DIR__ . "/project/home.php");
});
$router->map('GET','/page1',function(){
include(__DIR__ . "/project/page1.php");
});
$match = $router->match();
if($match && is_callable($match['target'])){
call_user_func_array($match['target'],$match['params']);
}
else{
//no route found
header($_SERVER['SERVER_PROTOCOL'].'404 Not Found');
}
主页的重定向是好的,但是如果我输入 localhost/page1 它会重定向到 404 错误页面。我认为这是因为默认的 wamp 服务器设置等。无论如何要改变它吗?