错误代码点火器:连接数据库过多


Error CodeIgniter: too many connection database

我的代码有问题,出现错误:

连接数据库太多。

这是我的控制器

class Api extends CI_Controller
{
    function __construct()
    {
        parent::__construct();
        $this->load->model('Application_model', '', TRUE);
    }
    public function index()
    {
        echo "Access Denied";
    }
      public function application_detail($application_key = null)
    {
        $response['isSuccess'] = false;
        $response['message'] = "data not found";
        if ($application_key != null) {
            $application = $this->Application_model->get_application_detail($application_key);
            if ($application != null) {
                $response['isSuccess'] = true;
                $response['message'] = "data found";
                $response[$application_key] = $application->$application_key;
            }
        }
        echo json_encode($response);
    }
    }

这是模型:

class Application_model extends CI_Model
{
    function get_application_detail($application_key)
    {
        $this->db
            ->select($application_key);
        $this->db->from('application');
        $query = $this->db->get();
        return $query->row();
    }
}

那么如何解决呢?

我在谷歌中找到的第一个链接修复许多连接错误

你试过吗?

更新:

第二种方法是将db_driver更改为更新

  1. 确保在PHP中启用extension=mysqli.so.ini(如果未安装,则应另外安装MySQLI软件包for PHP)

  2. 将代码点火器中的数据库驱动程序更改为"数据库驱动程序" => "mysqli"

希望这有帮助。