我有以下几行用于数据库连接的代码,但是我只想使用我的 include("config.php") 而不是这长长的代码行,我将如何去做
try {
$dbh = new PDO('mysql:host=localhost;dbname=lms;charset=UTF-8', 'root', 'password');
}
catch (PDOException $e) {
die('unable to connect to database ' . $e->getMessage());
}
// create LM object, pass in PDO connection
$lm = new lazy_mofo($dbh);