当我使用try catch块,例如:PHP,PDO,SQL,尝试捕捉,连接
try{
require_once('../php/connect.php');
$dbh = db::getInstance();
// What i am trying to understand should i close the connection here before the header?
header("Location: x.php");
}
} catch(PDOException $e){
require_once('err.php');
}
$dbh = null; // Or should i close the connection here?
是对 “解释” 行之后,甚至得到 “5”,谢谢大家,有一个很好的天。
这根本没有意义。您正在设置$ dbh,如果没有抛出异常,您将发送一个Location标头,它将退出脚本。我没有看到你的问题。 – jonas
你意识到你有双重错误吗? – Layke
我很抱歉,如果我的代码没有任何意义,它只是它的代码的一部分,在连接到标题之间时,您可以在按下时发送问题发送连接下方的代码,将数据输入到数据库中,标题带你到你的问题。 –