我的代码一直在运行,直到我将EasyPHP从13.1VC11升级到14.1VC9。现在,当我第一次开始使用PDO时,它会抛出一个错误。我尝试了代码测试程序,它抛出了同样的错误。
致命错误:在第9行的C:\ Program Files(x86)\ EasyPHP-DevServer-14.1VC9 \ binaries \ home \ codesource.php中调用未定义的方法PDOException :: get_Message()
我检查过,据我所知,PDO已经安装完毕。我在想,以某种方式指向代码的指针搞砸了。我似乎无法超越这个。
以下是代码测试人员的代码:
<?php
$dbusername="myuserid";
$dbpassword="mypassword";
try {
$dbh= new PDO('mysql:host=localhost;dbname=cdlmoves', $dbusername, $dbpassword);
}
catch (PDOException $pe)
{
die ("I cannot connect to the database." . $pe->get_Message());
}
?>