【发布时间】:2015-08-31 18:58:36
【问题描述】:
我的应用在 C:\xampp\htdocs\urlrouter\klein\
我使用 composer 安装了klein 路由器。
而且,我使用这个脚本只是为了简单的基本路由
define('APP_PATH', '/urlrouter/klein/');
require_once 'vendor/autoload.php';
$request = \Klein\Request::createFromGlobals();
$request->server()->set('REQUEST_URI', substr($_SERVER['REQUEST_URI'], strlen(APP_PATH)));
$klein = new \Klein\Klein();
$klein->respond('GET', '/hello', function () {
return 'Hello World!';
});
$klein->dispatch($request);
我也有这个 .htaccess
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule . /index.php [L]
但是,当我转到 http://localhost/urlrouter/klein/hello 时,它会将我重定向到 XAMPP 主页或 http://localhost/xampp/splash.php
我不知道这个路由器有什么问题。请帮帮我
【问题讨论】:
标签: php .htaccess xampp klein-mvc