【发布时间】:2014-12-03 02:37:43
【问题描述】:
我正在尝试在 fatfree 框架中使用命名空间,但不知何故它无法找到下面的类是我的设置
routes.ini
[routes]
GET /=Src\Controllers\Index->index
index.php
namespace Src\Controllers;
class Index {
function index($f3) {
$f3->set('name','world');
echo View::instance()->render('template.htm');
}
}
全局索引.php
// Retrieve instance of the framework
$f3=require('lib/base.php');
// Initialize CMS
$f3->config('config/config.ini');
// Define routes
$f3->config('config/routes.ini');
// Execute application
$f3->run();
更新:
错误:
找不到
HTTP 404 (GET /)
• index.php:13 Base->run()
更新 2:
config.ini
[globals]
; Where the framework autoloader will look for app files
AUTOLOAD=src/controllers/
; Remove next line (if you ever plan to put this app in production)
DEBUG=3
; Where errors are logged
LOGS=tmp/
; Our custom error handler, so we also get a pretty page for our users
;ONERROR=""
; Where the framework will look for templates and related HTML-support files
UI=views/
; Where uploads will be saved
UPLOADS=assets/
我不确定出了什么问题。
提前致谢。
【问题讨论】:
-
您遇到错误了吗?你设置autoloading了吗?
-
我没有收到任何令人沮丧的错误,而且我被困了很长时间。
标签: php namespaces fat-free-framework