PHP 5.4.45 Released

mysqli::close

mysqli_close

(PHP 5)

mysqli::close -- mysqli_closeCloses a previously opened database connection

Descrierea

Stil obiect-orientat

bool mysqli::close ( void )

Stil procedural

bool mysqli_close ( mysqli $link )

Closes a previously opened database connection.

Open non-persistent MySQL connections and result sets are automatically destroyed when a PHP script finishes its execution. So, while explicitly closing open connections and freeing result sets is optional, doing so is recommended. This will immediately return resources to PHP and MySQL, which can improve performance. For related information, see freeing resources

Parametri

link

Numai stilul procedural: Un identificator al legăturii întors de mysqli_connect() sau mysqli_init()

Valorile întoarse

Întoarce valoarea TRUE în cazul succesului sau FALSE în cazul eșecului.

Exemple

See mysqli_connect().

Note

Notă:

mysqli_close() will not close persistent connections. For additional details, see the manual page on persistent connections.

A se vedea și

add a note add a note

User Contributed Notes 1 note

up
4
php at dafydd dot com
6 years ago
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.
To Top