Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我将开发一个网站,可能有成千上万的用户同时使用它和数据库功能。近年来,我从未在我的应用程序中关闭我的数据库连接。在这种情况下,在运行每个查询后关闭数据库连接还是保持打开状态更好?
我知道如果没有关闭连接池等就会耗尽,但我试图寻找特别是 MySql 的答案,但我不是很幸运。
我正在使用 Codeigniter 2.1,MySql 和 PHP。
谢谢
您不必手动关闭连接。PHP 将在脚本执行结束时自动为您关闭它。