How to close the database connection in php: You can use the mysqli_close() function to close the previously opened database connection. The specific usage method is: [mysqli_close($conn)], if successful, it returns TRUE, otherwise it returns FALSE.
The mysqli_close() function closes the previously opened database connection, returning TRUE if successful and FALSE if failed.
(Recommended tutorial: php graphic tutorial)
Function syntax:
mysqli_close(connection);
(Recommended video tutorial: php video tutorial)
Code implementation:
<?php $con=mysqli_connect("localhost","my_user","my_password","my_db"); // ....一些 PHP 代码... mysqli_close($con); ?>
The above is the detailed content of How to close database connection in php. For more information, please follow other related articles on the PHP Chinese website!