将对句柄的所有引用设置为null(或者实际上除了PDO对象之外的任何内容),运行时将破坏对象,这将关闭连接.
$db = new PDO('...');
// Do some stuff
$db = null;
// Assuming this was the last reference to that PDO
// object, the runtime will destroy the object and
// its connection.
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
9727 次 |
| 最近记录: |