开发者

How to correctly free a PDO instance

for example:

$db = new PD开发者_开发百科O();
// some code using $db here
// and next, i want to free this var and close all connection and so on
$db = NULL; // or how correctly?

Is that correct way to free all SQL results and connections?


you could do that, but often not necessary. if created in a function and no other vars are using it, $db will release its contents when it goes out of scope (usually at the end of the function). if $db is a global, it will be released when the script ends.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜