在转向 PDO 之前我使用了这段代码:
if (class_exists('SQLiteDatabase')) {
return 'jargon.db';
} else if (class_exists('SQLite3')) {
return 'jargon3.db';
} else {
throw new Exception('SQLite not installed');
}
Run Code Online (Sandbox Code Playgroud)
我怎样才能使用 PDO 做同样的事情
要检查 SQLite 版本,您可以使用以下代码:
$dbh = new PDO('sqlite::memory:');
print_r("SQLite version " . $dbh->query('select sqlite_version()')->fetch()[0]);
$dbh = null;
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2394 次 |
| 最近记录: |