using mysql_close()

前端 未结 4 1971
北海茫月
北海茫月 2020-12-03 22:33

is it necessary to use mysql_close() at the end of a query in PHP?

相关标签:
4条回答
  • 2020-12-03 22:42

    No. When the PHP requests ends all resources will be freed, including MySQL connection resources.

    0 讨论(0)
  • 2020-12-03 22:47

    Using mysql_close() isn't usually necessary, as non-persistent open links are automatically closed at the end of the script's execution. See also freeing resources.

    read more at :

    http://php.net/manual/en/function.mysql-close.php

    0 讨论(0)
  • 2020-12-03 22:49

    In the manual :

    mysql_close() closes the non-persistent connection to the MySQL server that's associated with the specified link identifier.

    Using mysql_close() isn't usually necessary, as non-persistent open links are automatically closed at the end of the script's execution.

    More reading about that here

    0 讨论(0)
  • 2020-12-03 22:53

    As answered by others and the manual, it's not necessary. But if you wonder the use; you usually only want to do this when there is more to come in the PHP script and you want to ensure that another connection/transaction is to be used then.

    0 讨论(0)
提交回复
热议问题