Welcome Guest, Not a member yet? Register   Sign In
Does Codeigniter automatically close the database connection
#1

Hi ,

I want to know Does Codeigniter automatically close the database connection or we have close manually.
If it  close the database connection automatically , where  can i check this code .
Reply
#2

Good question.

I have made this MY_Model located at "core" folder and extends all my models to this.

class MY_Model extends CI_Model
{

/**
* MY_Model constructor.
*/
public function __construct()
{
parent::__construct();
}

public function __destruct()
{
$this->db->close();
}

}
PHP Developer. Codeigniter Fan. Family Lover.
Reply
#3

Manually closing the Connection
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply
#4

You don't need to.

During shutdown, PHP itself closes any resources that haven't been closed.
Reply




Theme © iAndrew 2016 - Forum software by © MyBB