当使用Codeigniter加载数据库时,我在加载数据库的一个简单文件中收到以下错误消息:
An Error Was Encountered
Unable to load the requested class: database
此代码的控制器称为db.php,其代码如下:
<?php
class Db extends MY_Controller {
function __construct() {
parent::__construct();
$this->load->library('database');
}
public function index() {}
}
我没有将数据库加载到autoload.php中。我还知道我的config.php文件中有正确的数据库信息。我的CodeIgniter应用程序在子域中,如果这可能会导致任何问题的话。
有什么想法可以引起这个问题吗?谢谢
使用$this->load->database();
代替$this->load->library('database');