File tree Expand file tree Collapse file tree 2 files changed +19
-0
lines changed Expand file tree Collapse file tree 2 files changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -289,6 +289,20 @@ public function connect()
289289 }
290290 }
291291
292+ /**
293+ * A method to disconnect from the database
294+ *
295+ * @throws Exception
296+ * @return void
297+ */
298+ public function disconnect ()
299+ {
300+ if (!$ this ->_mysqli )
301+ return ;
302+ $ this ->_mysqli ->close ();
303+ $ this ->_mysqli = null ;
304+ }
305+
292306 /**
293307 * A method to get mysqli object or create it in case needed
294308 *
Original file line number Diff line number Diff line change @@ -699,6 +699,11 @@ if($db->has("users")) {
699699}
700700```
701701### Helper methods
702+ Disconnect from the database:
703+ ``` php
704+ $db->disconnect();
705+ ```
706+
702707Reconnect in case mysql connection died:
703708``` php
704709if (!$db->ping())
You can’t perform that action at this time.
0 commit comments