$dsn="mysql:host=localhost;dbname=php_edu;charset=utf8;";
$root='root';
$password='123456';
try {
$pdo=new PDO($dsn,$root,$password);
} catch (PDOException $e) {
//捕获异常信息,并退出程序
exit($e->getMessage());
}