现在想对PHP连接mysql的代码做try,catch处理.
应该怎么做,当出现连接数据库失败的时候,返回一串自定义的内容.
try {
$this->conn = new mysqli('192.168.1.101','root','root11','testdb1');
}catch(Exception $e)
{
return $e->getMessage();
}
应该怎么做,当出现连接数据库失败的时候,返回一串自定义的内容.
try {
$this->conn = new mysqli('192.168.1.101','root','root11','testdb1');
}catch(Exception $e)
{
return $e->getMessage();
}
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货