0

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

<?

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 错误!

有人可以帮帮我吗?!

4

1 回答 1

0

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

于 2012-12-08T00:46:23.453 回答