I've had situations where database connections appeared to persist following php execution. So, now, my __destructor function explicitly contains a $cxn->close(). It hurts nothing, and helps avoid memory leaks.
(PHP 5, PHP 7)
mysqli::close -- mysqli_close — 关闭先前打开的数据库连接
成功时返回 TRUE
, 或者在失败时返回 FALSE
。
See mysqli_connect().
I've had situations where database connections appeared to persist following php execution. So, now, my __destructor function explicitly contains a $cxn->close(). It hurts nothing, and helps avoid memory leaks.