关于php的出错处理
public function conSql($server,$name,$password)
{
try{
$con=mysql_connect($server,$name,$password)
or die("something is wrong with the database,can not connected");
if (!$con)
throw new Exception("cannot connect to the Mysql Server") ;
}catch (Exception $e)
{
echo $e."Please Check the password and the username";
}
}
请高手帮忙讲解一下上面的代码,写这些代码有什么用处?