【问题标题】:Slim aways show 404 error pageSlim aways 显示 404 错误页面
【发布时间】:2012-11-22 19:39:07
【问题描述】:

我正在尝试在我的 Mac 上的 XAMPP 或 MAC OS 的本机 Apache 服务器下测试 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 错误!

有人可以帮帮我吗?!

【问题讨论】:

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


    【解决方案1】:

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2012-07-12
      • 1970-01-01
      • 1970-01-01
      • 2013-08-27
      • 2013-08-13
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多