我正在尝试设置和学习 PHP 的 Fat Free 框架。 http://fatfree.sourceforge.net/
设置起来相当简单,我正在使用 MAMP 在我的机器上运行它。
我能够让“hello world”示例运行正常:
require_once 'path/to/F3.php';
F3::route('GET /','home');
function home() {
echo 'Hello, world!';
}
F3::run();
但是当我尝试添加第二部分时,它有两条路线:
require_once 'F3/F3.php';
F3::route('GET /','home');
function home() {
echo 'Hello, world!';
}
F3::route('GET /about','about');
function about()
{
echo 'About Us.';
}
F3::run();
如果我尝试第二个 URL:/about,我会收到 404 错误
不知道为什么其中一个mod_rewrite
命令会起作用,而另一个则不起作用。
下面是我的.htaccess
文件:
# Enable rewrite engine and route requests to framework
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-l
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* index.php [L,QSA]
# Disable ETags
Header Unset ETag
FileETag none
# Default expires header if none specified (stay in browser cache for 7 days)
<IfModule mod_expires.c>
ExpiresActive On
ExpiresDefault A604800
</IfModule>