致命错误:调用未定义的方法PDOException :: get_Message()
问题描述:
我的代码正在运行,直到我将EasyPHP从13.1VC11升级到14.1VC9。现在,当我第一次使用PDO时,它会引发错误。我试过了代码测试器,它抛出了相同的确切错误。致命错误:调用未定义的方法PDOException :: get_Message()
Fatal error: Call to undefined method PDOException::get_Message() in C:\Program Files (x86)\EasyPHP-DevServer-14.1VC9\binaries\home\codesource.php on line 9
我检查了,并且据我所知,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());
}
?>
['的getMessage()'](HTTP:// www.php.net/manual/en/exception.getmessage.php),而不是'get_Message()' – BlitZ
投票结束;简单的印刷错误 – Phil