I am using PHP mongoDB driver ver 1.1.8 My PHP code for establishing a connection to MongoDB goes like this
$conn=new MongoDB\Client("mongodb://localhost:27017");
But the problem is , each time a client refresh the page a new connection is established. Therefore i want to close the connection at the end of the PHP script.
Earlier i used to close a connection with this code
$conn->close();
But this is not working in the new PHP MongoDB drivers.
$conn->close();
is out dated and will not work with current driver.
The new driver is designed to leave connections open , and there is no method of turning that off.
Refer This
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.