且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

PDO无法在Wamp服务器上的php中工作

更新时间:2023-02-22 20:19:08

您正在使用$conn->,就像使用$db进行连接一样,因此下面的代码段

You are using $conn-> where as you are using $db for connection so the below snippet

$conn ->prepare($query);

应写为

$db->prepare($query);


此外,您从哪里获得的$exception?您的catch语句应类似于


Also, where did you got $exception from? Your catch statement should look like

catch(PDOException $exception) {

}