PDO连接数据库

Original 2019-05-09 23:26:22 151
abstract:$dsn="mysql:host=localhost;dbname=php_edu;charset=utf8;";$root='root';$password='123456';try { $pdo=new PDO($dsn,$root,$password);} catch (PDOException $e) {//捕获异常信息,并退出程序 ex

$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());

}


Release Notes

Popular Entries