如何捕获PHP 连接mysql错误现在想对PHP连接mysql的代码做try,catch处理.应该怎么做,当出现连接数据库失败的时候,返回一串自定义的内容.
try {$this->conn = new mysqli('192.168.1.101','root','root11','testdb1');}catch(Exception $e) { return $e->getMessage(); }