<?php
$connect = @mysql_connect("hostname","user","password") or die("Unable to connect database server!");
。。。//数据库操作,很多行代码!
$close = @mysql_close($connect) or die ("Unable to close database server connect!"); //最后关闭前面打开的连接!
?>
如果是变量对象使用后,记得显式的操作unset(变量/对象名);