【发布时间】:2016-06-24 17:56:44
【问题描述】:
我目前遇到了无脂肪框架的路由问题。环顾四周并阅读文档后,尽管这似乎是一个简单的问题,但我至今无法解决它。
我在根目录下使用f3的标准路由格式:
$f3->route(array('GET /', 'GET /index.php'), function($f3) {
include 'header.html';
include 'Home/index.html';
include 'footer.html';
});
//search
$f3->route('GET /Browse', function() {
include 'Browse/index.html';
});
这些路由都按预期正常工作。当我在 xammp 上输入 localhost 时,两者都返回概述的页面。两者都有一个文件结构:
-Root
-index.php
-header.html
-footer.html
--Browse
---index.html
定义新路由后,我不希望有一个包含 index.html 文件的文件夹,而是通过回显 html 来响应。
$f3->route('GET /Latest',
function() {
include 'submit/index.html';
echo 'This is our home page.';
}
);
当我使用上面的代码并转到 localhost/Latest 时,我会看到:
Error 404 : Not found
我的问题是,如何在没有后续文件夹和 index.html 文件的情况下允许直接来自 PHP 的响应。
谢谢和许多问候:)
【问题讨论】: