开发者

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');, I see the error ErrorException [ Fat开发者_高级运维al Error ]: Class 'Database' not found. 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):

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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜