// 异常处理类

try{
// 捕获异常

$dsn = ‘mysql:dbname=s72;host=localhost;charset=utf8’;
$user = ‘root’;
$pwd = ‘123’;
$pdo = new PDO($dsn, $user, $pwd);

}catch(Exception $e){
// 处理异常
// echo ‘链接数据库失败’;
echo $e->getMessage().'<br>’;
echo $e->getLine().'<br>’;
echo $e->getFile().'<br>’;
echo $e->getCode().'<br>’;
}