我在Windows上使用XAMPP,我正在使用PDO连接到我的数据库。 但是,我在我的网页上找不到驱动程序错误。我已经看到很多基于此错误的问题。但大多数解决方案是启用PDO_mysql。如下图所示,我的pdo_mysql已经启用,我已经在php.ini上放置了正确的扩展和dir配置。似乎没什么用。 这是错误消息:
object(PDOException)[2]
protected 'message' => string 'could not find driver' (length=21)
private 'string' (Exception) => string '' (length=0)
protected 'code' => int 0
protected 'file' => string 'C:\xampp\htdocs\phpTest\index.php' (length=33)
protected 'line' => int 56
private 'trace' (Exception) =>
array (size=1)
0 =>
array (size=6)
'file' => string 'C:\xampp\htdocs\phpTest\index.php' (length=33)
'line' => int 56
'function' => string '__construct' (length=11)
'class' => string 'PDO' (length=3)
'type' => string '->' (length=2)
'args' =>
array (size=3)
...
private 'previous' (Exception) => null
public 'errorInfo' => null
public 'xdebug_message' => string '<tr><th align='left' bgcolor='#f57900' colspan="5"><span style='background-color: #cc0000; color: #fce94f; font-size: x-large;'>( ! )</span> PDOException: could not find driver in C:\xampp\htdocs\phpTest\index.php on line <i>56</i></th></tr>
<tr><th align='left' bgcolor='#e9b96e' colspan='5'>Call Stack</th></tr>
<tr><th align='center' bgcolor='#eeeeec'>#</th><th align='left' bgcolor='#eeeeec'>Time</th><th align='left' bgcolor='#eeeeec'>Memory</th><th align='left' bgcolor='#eeeeec'>Function</th><th align='le'... (length=1171)