Mongo
PHP Manual

Mongo::close

(PECL mongo >=0.9.0)

Mongo::closeCloses this connection

说明

public bool Mongo::close ( void )

The Mongo::close() method forcefully closes a connection to the database, even if persistent connections are being used. You do under normal circumstance never have to do this.

If you are connected to a replica set, close() will only close the connection to the primary.

参数

此函数没有参数。

返回值

Returns if the connection was successfully closed.

更新日志

版本 说明
1.2.0

Before version 1.2.0 the driver would not use persistent connections by default, and all connections would be closed as soon as a MongoDB connection went out if scope. Since version 1.2.0 this is no longer the case and it is a bad idea to call close as you might end up overloading the server with connections under high load.


Mongo
PHP Manual