我用 F3 (fat free framework) 2.0 完成了一个简单的项目,一切都很好。现在我开始了一个新项目,我发现它已经发生了很大的变化。我创建了一个简单的基本测试,只是不断地遇到错误和怪异。我不是 F3 专家,是的,我已经阅读了文档,当然,我可能错过了一些东西。希望有人可以帮助我。这是我失败的例子:
从我的配置文件开始
配置文件
cfgDbConnection="mysql:host=localhost;port=8889;dbname=test";
cfgDbUser="root"
cfgDbPassword="123456"
cfgCache=true
//...ETC
起点
索引.php
$f3=require('lib/base.php');
$f3->set('UI','ui/');
$f3->set('AUTOLOAD', 'classes/'); // this folder contains class objects for the project
$f3->config('config.cfg');
$f3->set('CACHE', $f3->get('cfgCache'));
$f3->set('DEBUG',3);
$db = new DB\SQL(
$f3->get('cfgDbConnection'),
$f3->get('cfgDbUser'),
$f3->get('cfgDbPassword')
);
$f3->set('DB',$db);
require_once("menuRoutes.php");
$f3->run();
用于路由的 5 个 php 文件中的第一个
menuRoutes.php
<?php
$f3->route('GET /', function() use ($f3){
AuthManager::authenticateSession($f3); // checks if user is logged in /classes/AutManager.php
echo View::instance()->render('landing.htm');
});
登陆.htm
<include href="mainHeaderBar.htm"/> (this has css & js loads)
general html.......
<include href="mainFooterBar.htm"/> (other jquery scripts)
此时页面加载了一般的 html,CSS 和 JS 脚本没有加载,因为包含没有加载,它们被忽略了......?
PHP 日志显示:
HTTP 405 (HEAD /)
/Users/home/Documents/My Projects/testApp/web/index.php:39 Base->run()
ob_clean(): failed to delete buffer. No buffer to delete
/Users/home/Documents/My Projects/testApp/web/lib/base.php:859 ob_clean()
/Users/home/Documents/My Projects/testApp/web/lib/base.php:1118 Base->error(405)
/Users/home/Documents/My Projects/testApp/web/index.php:39 Base->run()
PHP Fatal error: Uncaught exception 'ErrorException' with message 'ob_clean(): failed to delete buffer. No buffer to delete' in /Users/home/Documents/My Projects/testApp/web/lib/base.php:1391
感谢您的帮助/建议。