[英]I can't connect to database
I use Kohana 3.2, and when I insert in the index.php controller $query = DB::query(Database::SELECT, 'SELECT * FROM posts ORDER By id DESC');
我使用Kohana 3.2,当我在index.php控制器中插入
$query = DB::query(Database::SELECT, 'SELECT * FROM posts ORDER By id DESC');
, I see the error ErrorException [ Fatal Error ]: Class 'Database' not found. ,我看到错误ErrorException [致命错误]:找不到类'Database'。 What do I do?
我该怎么办?
This isn't a database error. 这不是数据库错误。 The database class cannot be found and I'm almost sure it's because of following reasons:
找不到数据库类,我几乎可以肯定是由于以下原因:
You probably haven't installed and configured the database module properly. 您可能尚未正确安装和配置数据库模块。 Make sure that the database module is in the module path you specified in the index file:
确保数据库模块位于索引文件中指定的模块路径中:
$modules = '../your/path/to/modules';
Furthermore, enable the module in your bootstrap (application/bootstrap.php): 此外,在您的引导程序(application / bootstrap.php)中启用该模块:
Kohana::modules(array(
// Rest of modules
'database' => MODPATH.'database',
));
More info about modules can be found here: http://kohanaframework.org/3.2/guide/kohana/modules 有关模块的更多信息,请参见: http : //kohanaframework.org/3.2/guide/kohana/modules
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.