• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
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


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.