PHP MySQL数据库连接 [英] PHP MySQL Database Connection

查看:88
本文介绍了PHP MySQL数据库连接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

执行查询(和其他数据库操作)后是否需要显式关闭数据库连接?

Is it necessary to explicitly close a DB connection after executing a query (and other DB operation)?

推荐答案

不,除非您确定已完成与数据库的通信以运行脚本.即使那样,除非您使用 显式关闭它,因为PHP在脚本执行完后会自动关闭它. net/mysql-pconnect"rel =" nofollow noreferrer> mysql_pconnect() 连接到您的数据库.

Nope, unless you're sure you've finished communicating with the database for the script run. Even then, you don't need to close it explicitly at all as PHP does that automatically after your script finishes executing, unless you're using mysql_pconnect() to connect to your database.

这篇关于PHP MySQL数据库连接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆