Slim aways显示404错误页面

时间:2012-12-05 02:38:45

标签: apache .htaccess xampp http-status-code-404 slim

我正在尝试在XAMPP下测试我的Mac上的Slim或从MAC OS测试本机Apache服务器,但在任何人的工作下。请遵循以下代码:

<?

require 'Slim/Slim.php';

\Slim\Slim::registerAutoloader();

$app = new \Slim\Slim();

$app->get('/', function () {
    echo '<h1>Sample test!!!</h1>';
});

// POST route
$app->post('/post', function () {
    echo 'This is a POST route';
});

// PUT route
$app->put('/put', function () {
    echo 'This is a PUT route';
});

// DELETE route
$app->delete('/delete', function () {
    echo 'This is a DELETE route';
});

$app->run();

?>

查看GET函数回调只打印H1文本。

我的.htaccess内容:

RewriteEngine On

# Some hosts may require you to use the `RewriteBase` directive.
# If you need to use the `RewriteBase` directive, it should be the
# absolute physical path to the directory that contains this htaccess file.
#
# RewriteBase /

RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [QSA,L]

我没有更改Slim网站上的原始文件中的任何内容,并且在浏览器上显示404错误!

有人可以帮助我吗?!

1 个答案:

答案 0 :(得分:0)

我使用的是5.2.x版本而不是5.3.x!