尝试连接到 4D 数据库。PHPINFO 说安装了 PDO 等等……在 localhost MAMP 系统上进行测试。但是,当我运行我的代码时,我得到:
Fatal error: Uncaught exception 'PDOException' with message 'could not find driver' in /Applications/MAMP/htdocs/4d/index.php:12 Stack trace: #0 /Applications/MAMP/htdocs/4d/index.php(12): PDO->__construct('4D:host=127.0.0...', 'test', 'test') #1 {main} thrown in /Applications/MAMP/htdocs/4d/index.php on line 12
我的代码是:
$dsn = '4D:host=127.0.0.1;charset=UTF-8';
$user = 'test';
$pass = 'test';
// Connection to the 4D SQL server
$db = new PDO($dsn, $user, $pass);
try {
echo "OK";
} catch (PDOException $e) {
die("Error 4D : " . $e->getMessage());
}
无法解决错误,我正在使用 PHP 选项卡下的设置...
谢谢你。