4
How can I check if a connection has actually been closed?
$con = new Conexao();
$con->abrirConexao();
...
$con->fecharConexao();
I use a variable to instantiate the class Conexao
which is in another file. I would just like to know how I can verify if the method fecharConexão()
actually closed the previously opened connection.
My method for closing the connection is this:
public function fecharConexao(){
return mysqli_close($this->conexao);
}
I would just like a notification (just so I know) that the connection has ended. How do I do this?
only by completing, if you want to be able to retrieve it at any time, save the return in a class attribute. Example: Connection started
$this->aberta = true
the connection ended$this->aberta = false
this will make it possible to create a method such aspublic function estaAberta()
and this function returns the value of$this->aberta
.– marcusagm