关闭和/或杀死phpi脚本末尾的mysqli连接? [英] Close and/or kill mysqli connection at the end of the php script?

查看:84
本文介绍了关闭和/或杀死phpi脚本末尾的mysqli连接?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是否需要在脚本末尾显式终止和/或关闭mysqli连接.目前,我既不执行任何操作,也可以运行,但是我的负载不大.

Do I need to explicitly kill and/or close a mysqli connection at the end of a script. At the moment, I do neither, and it works, but I don't have much load.

我听说有连接池,并且mysqli连接已被重新使用...我是否需要完全关闭连接?

I've heard that there is connection pooling, and mysqli connections are re-used... do I need to close the connection then at all?

推荐答案

您应始终在主脚本的末尾关闭连接.如果您使用一些php5和对象来处理数据库,请考虑使用__destruct()自动关闭数据库

You should always close your connections at the end of the main script. If you uses some php5 and object to handle your DB just think about using __destruct() to automatically close it

http://php.net/manual/en/language.oop5. decon.php

这篇关于关闭和/或杀死phpi脚本末尾的mysqli连接?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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